var name = 'Peter Wraae Marino';
var data ="name="+name;
$.ajax({
type: "GET",
data: data,
cache: false,
dataType: "json",
success: function(msg){
alert( msg);
},
error: function( XMLHttpRequest, textStatus, errorThrown ){
var t = "XMLHttpRequest: "+XMLHttpRequest+"\n";
t+= "textStatus: "+textStatus+"\n";
t+= "errorThrown: "+errorThrown+"\n";
alert( t );
}
});
in php file
just echo ur post variable like this
echo $_POST['name'];
Now u can get ur post name into alert pop up
Hope this code u wanted?
On Mon, Jun 1, 2009 at 11:39 AM, Peter Marino <marino.peter@gmail.com> wrote:
Hi jQuery,I'm very new to the json stuff (so warned)...when I try the following:var data ={"member" :{"name" : "Peter Wraae Marino"}}$.ajax({type: "GET",data: data,cache: false,dataType: "json",success: function(msg){alert( msg );},error: function( XMLHttpRequest, textStatus, errorThrown ){var t = "XMLHttpRequest: "+XMLHttpRequest+"\n";t+= "textStatus: "+textStatus+"\n";t+= "errorThrown: "+errorThrown+"\n";alert( t );}});I get an error message saying parsing error, I assume this means my data format is wrong.but when I see how other people have used json data format then I think the way I did it is right?can someone help me out here?regards,Peter
--
Power Tumbling - http://www.powertumbling.dk
OSG-Help - http://osghelp.com
--
---| Regard |---
Mohd.Tareque
No comments:
Post a Comment