Scary AJAX error
May 15, 2006
/ Filed under: JavaScript, Tips
While doing some AJAX work this morning, I kept getting this error, which looks pretty scary:
Ugly, eh? Yuck. It was "tripping up" on the line in my JavaScript that began like this:
Now why would it stop there? Anyone familiar with AJAX would recognize that line as the "check" for data that’s been returned from a remote server call. In other words, if our remote server call returns data, the status would be 200. If not, the status would be 204, which means No Content. I was positive the remote call returned data, because I checked the query myself. Turns out my problem had to do with the "trigger" that initially began the AJAX request. The "trigger" is an HTML form button, which looked like this:
This is just a simple "form submit" button. However, it doesn’t actually submit the form through the Long story short (I think I already made this too long), I had to change the submit button to this:
You see, it was trying to submit the form, at the same time as running the AJAX call, behind the scenes. By changing the So, to sum this jibberish up - if you ever see that error - check your "trigger."
Comments/Mentions
|
Editor Picks
Email NewsletterSubscribe to the digest newsletter to receive posts by email: Recent Comments
Advertisements
|
I just wanted to thank you for writing this blog entry. It gave me just what I needed to figure out why I was getting the same error. I had an input with an onchanged event within a form and when I removed the form (since it was really unneeded) the error went away.
Thanks again!