I am trying to use jquery to do a client side validation to do a check and return with a error or success.
I know how to echo text/html back as the response, but here’s what I am trying to do.
On Error, send back a message, so the user can re-submit a form.
On Success, re-load the page.
I am not sure how to get it to send a variable which I think will let me do either condition in jquery.
Any suggestions??
The javascript could be somthing like this
Now in the ajax PHP file you could have this
Hope this helps! Metropolis
EDIT SINCE NEW INFO
If you would like to use a json object you could do it like the following
Its not really a big deal if you use json or not, you can still pass a string back either way. I think json is really better for more complicated data that you need to pass back, but theres probably 10 different ways to do this.