JQuery and JSON

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
maige
Forum Newbie
Posts: 1
Joined: Mon Jul 30, 2007 12:26 am

JQuery and JSON

Post by maige »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi everyone   

I'm trying to send JSON data from PHP to JQuery and use JQuery to output the JSON data.

I used json_encode() to make the array into JSON format.

I can't seem to access the JSON data in JQuery though.

[syntax="javascript"]
$(document).ready(function(){
	$("#myForm").submit( function() {
  		$.getJSON("something.php", function (json)
	    {
			alert("JSON Data is received!");
	    });
	});
});
Is there something wrong in the code?


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply