Welcome Guest, Not a member yet? Register   Sign In
Javascript array to PHP (to save in MySQL)
#4

[eluser]richthegeek[/eluser]
I usually do it like this:

Code:
$.post( base_url + "ajax/save_boxes", { boxes: JSON.encode( boxes ) } )

This goes to the Ajax:Confusedave_boxes() method in /system/application/controllers/ajax.php, which then uses PHP's json_decode to parse it.

PS: the "base_url" variable in the JS is set in the header file like so:
Code:
[removed]var base_url = '<?=base_url();?>'[removed]


Messages In This Thread
Javascript array to PHP (to save in MySQL) - by El Forum - 12-18-2010, 03:44 PM
Javascript array to PHP (to save in MySQL) - by El Forum - 12-18-2010, 03:56 PM
Javascript array to PHP (to save in MySQL) - by El Forum - 12-18-2010, 04:15 PM
Javascript array to PHP (to save in MySQL) - by El Forum - 12-18-2010, 05:22 PM
Javascript array to PHP (to save in MySQL) - by El Forum - 12-18-2010, 08:56 PM
Javascript array to PHP (to save in MySQL) - by El Forum - 12-19-2010, 05:47 AM
Javascript array to PHP (to save in MySQL) - by El Forum - 12-19-2010, 08:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB