views:

52

answers:

3
A: 

I think you should use:

 $('.result1').html(msg.name);
Mike
That won't make any difference.
sje397
In JavaScript, dot notation can often be substituted for array notation. That's how something like document.forms["myForm"].elements["name"].value can be shortened to document.myForm.name.value (not that it's a good idea to do it).
kevinmajor1
you are right, guys, sorry :)
Mike
+5  A: 

The dataType parameter has a capital T. It works if you correct this.

Currently it is (by default) trying to guess the response format based on the mime-type, so probably defaulting to html - debugging in firebug you can see that the msg argument of the success callback is a string containing the JSON.

Tom Haigh
+1 eagle eye...
jAndy
You must be kidding me... It works now, OMG, I can't believe...
hey
Good catch.....
sje397
A: 

Not to distract you from solving this problem. But you may want to look into the .getJSON() function http://api.jquery.com/jQuery.getJSON/. It's a little cleaner if you're just getting some data.

Also, take a look at the JSON format, I think data: "id=1" should be data: "{id:1}"

And on the response side, keep in mind it's expecting multiple records so try: msg[0].name;, check out the each() function to process multiple records.

Dan Williams