This is my function in javascript:
function callRemoteService(requestId, sObjectId, bObjectId) { $.ajax({ url: "../../../serviceRemoteEngine.php", dataType: "json", contentType: "application/json", type: "POST", timeout: 1000, data: JSON.stringify({"requestId":requestId,"SOobjectId":sObjectId,"SBobjectId":bObjectId}), success: function(remoteResponse){ alert(remoteResponse.msg); } }); } And this is serviceRemoteEngine.php:
echo json_encode(array("msg" => $_POST["SOobjectId"])); The function is called with these parameters:
callRemoteService('remove', 15, 0) The thing is that, instead of seeing 15 in alert message, null is displayed instead.
However, when I change PHP file into:
echo json_encode(array("msg" => "message")); "message" text is displayed with js alert.
Why?