Passing array between php and jquery back and forth -
I am creating a notification system in which I get the user's line number from the table, whose new notifications came in the bus. I want to save those line numbers in the array and pass it to jquery which tells php to get line numbers ... this works perfectly, I want to know that Jason has a different Return the object with all the array values on the php page and get one value after that array and do some work on each value .... How can I do this? I have searched a lot, but there is nothing available to meet the requirement. Can somebody help me out?
If I understand you correctly, then you have a JSON object in javascript / jquio and You want to send it to PHP again via Ajax, so why do not you do it like this:
In Javascript:
function sendJSONToPHPAgain (jsonData) $. Ajax ({url: 'endpoint.php', data: {Json: JSON.stringify (jsonData)}, content type: "Application / Jason",}); }
In PHP (endpoint.php):
$ json = json_decode ($ _ request ['json'], $ assoc = true); // Now there is a good PHP array to work with ...
For example, use it like this:
var D = {a: 2, b: 3, c: "hello world"}; SendJSONToPHPAgain (d);
Or am I missing something?
Comments
Post a Comment