I would like to send data using jQuery ajax API
var myData = {"param1" : $('#txtParam1').val(), "param2" : $('#txtParam2').val()};
$.ajax({
url: 'DataService.php?action=SomeAction',
type: 'POST',
data: myData,
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function(result) {
alert(result.Result);}
});
When I tried to retrieve this data on php using
$param1 = $_REQUEST['param1'];
$param1
is showing null
and print_r($_REQUEST)
is only showing action = SomeAction ..
How to retrieve the posted data on php page ?