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:
- Do not
preventDefault
for the submit button click event - Make sure that
#protectivepanel
exists when you bind to it. - Move the
hide
/removeClass
functionality into yoursuccess
callback function. You may also want to provide anerror
callback.
Post a Comment for "Jquery Ajax Post Return Data , Uncaught Referenceerror: Data Is Not Defined"