Reputation: 3028
I'm making a signup form in which i've used following function for validate signup this function is called when a form is attempted to submit.
$.ajax({
type: "POST",
url: "view/ajax/php/checkcap.php",
data: $('#capform').serialize(),
dataType: "json",
async: false,
success: function(msg){
alert(msg.txt);
// other validations
}
})
here alert is just for display response from checkcap.php file. it works perfectly with jquery 1.3.2 however i've upgraded the jquery 1.3.2 to 1.6.2. after using jquery 1.6.2, however function gets response from the php file (checked using firebug) but can't display the message (response from php file). how to make the code work with jquery 1.6.2 ?
Upvotes: 0
Views: 626
Reputation: 46
make sure the json format is
{
"one": "Singular sensation",
"two": "Beady little eyes",
"three": "Little birds pitch by my doorstep"
}
http://api.jquery.com/jQuery.getJSON/
You are missing double quotes on propertynames
{"status":0,"txt":"a"} ---correct
{status:0,txt:"a"} ---wrong
Upvotes: 1