Skip to content Skip to sidebar Skip to footer

Jquery Ajax Post Return Data , Uncaught Referenceerror: Data Is Not Defined

I have a script that grabs the input text field from a div container called the protectivepanel. I am doing an ajax post call for this text field to be checked in the backend. If

Solution 1:

The e.preventDefault in #the_submit_button's click event prevents the submission of the form which actually makes the ajax call. Since the submit event is bound outside of document.ready, it is possible that nothing is bound either.

Finally, you cannot return from the ajax callback. Anything that relies on the result of the callback has to be done within the scope of the callback. Fix these three things:

  1. Do not preventDefault for the submit button click event
  2. Make sure that #protectivepanel exists when you bind to it.
  3. Move the hide/removeClass functionality into your success callback function. You may also want to provide an error callback.

Post a Comment for "Jquery Ajax Post Return Data , Uncaught Referenceerror: Data Is Not Defined"