javascript - Pass object to PHP through AJAX -


i wondering if possible pass array php function using jquery ajax function. have following javascript

arr_data = {     field01: "data 01",     field02: "data 02",     field03: "data 03",     field04: "data 04" }  $.ajax({     url: "scripts/php/phpfunc.php",     type: "get",     datatype: "json",     data: {         'action': "exec_find",         'field01': arr_data["field01"],         'field02': arr_data["field02"],         'field03': arr_data["field03"],         'field04': arr_data["field04"]     },     success: function(result) {         // continue program     },     error: function(log) {         // handle error     } }); 

when try following though

arr_data = {     field01: "data 01",     field02: "data 02",     field03: "data 03",     field04: "data 04" }  $.ajax({     url: "scripts/php/phpfunc.php",     type: "get",     datatype: "json",     data: {         'action': "exec_find",         'data': arr_data     },     success: function(result) {         // continue program     },     error: function(log) {         // handle error     } }); 

i receive in php "array". how can correctly send object usable php function?

from second ajax can access data based on property names like: $_get['data']['field01']

$_get['data'] js object converted in php in associative array


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -