make data as per jquery ajax data method
Am doing doing, Edit in place using jquery, if my snippet is too complicated, refer easiest one,
'column2' => "RAJANgsfdgf"
'column3' => "SRARDHAMgsdfgdf"
'column4' => "40043433"
'column7' => "23-01-2011 08:00:00"
'column5' => "400e"
'column6' => "1503"
i want to make this into somthing like
( {column2 :"RAJANgsfdgf"},{column3 :"SRARDHAMgsdfgdf"},{column4 :"40043433"},{column7 :"23-01-2011 08:00:00"},{column5 :"400e"},{column6 :"1503"})
some 开发者_如何学Pythontime my values somthing like this also
'column2' => "RAJANgsfdgf"
'column4' => "40043433"
'column7' => "23-01-2011 08:00:00"
'column6' => "1503"
then i should form
( {column2 :"RAJANgsfdgf"},{column4 :"40043433"},{column7 :"23-01-2011 08:00:00"},{column6 :"1503"})
So this somthing like dynamic, What ever , when ever program find some column and its equlent value, then automatically form the data somthing like above,
Am going to give this new data into jquery ajax, that's y am forming fomthing like this,
var collection_of_updated_data = common.dump(o.changed);
collection_of_updated_data = jQuery.trim(collection_of_updated_data);
*****************HERE AM GETTING THAT column1 and value******************
alert(collection_of_updated_data);
$.ajax({
url: "program_event_ajax_update.php",
global: false,
type: "POST",
data: collection_of_updated_data,
dataType: "html",
async:false,
success: function(msg){
alert(msg);
}
}
)
If I understand what you want to do correctly, you'd like to take an associative array and turn it into a string representation.
json_encode() is a method to do that. There are implementations for both PHP and Javascript (you mention you're using Javascript, but your array syntax looks more like PHP).
Does this look like the right avenue? (Or am I misinterpreting your original question?)
精彩评论