I have to send details to the web service. I have made a JSON string in which the details are stored, str_table
is the JSON string which I have to pass to the web service.
I tried many things from Google, but nothing worked. Following is among those things which I tried. Please check where I am going wrong.
$.ajax({
type:"POST",
url:"hostname/proj_folder/name.php?content="+str_table,
contentType: "application/json; charset=utf-8",
crossDomain:true,
dataType:'json',
success: alert("in success"),
error: alert("in error")
});
I have used data in the following code, and now it alerts error[object Object]
$.ajax({
type:"POST",
url:"hostname/proj_folder/name.php?",
contentType: "application/json; charset=utf-8",
data:JSON.stringify('content='+str_table),
crossDomain:true,
dataType:'json',
success: function(data){
alert('succes' + data);
},
error: function(data){
alert('error' + data);
}
});