POST Request
$.ajax({
url:"http://hayageektest.appspot.com/cross-domain-cors/post.php",
data:"name=Ravi&age=12",
type:"POST",
dataType:"json",
success:function(data)
{
alert("Data from Server"+JSON.stringify(data));
},
error:function(jqXHR,textStatus,errorThrown)
{
alert("You can not send Cross Domain AJAX requests: "+errorThrown);
}
});
GET Request
$.ajax(
{
url:"http://hayageektest.appspot.com/cross-domain-cors/get.php?name=Ravi&age=32",
dataType:"json",
success:function(data)
{
alert("Data from Server"+JSON.stringify(data));
},
error:function(jqXHR,textStatus,errorThrown)
{
alert("You can not send Cross Domain AJAX requests : "+errorThrown);
}
});
Please Share it with your friends: