i'm trying to work on a design website where users can design something on html5 canvas and than save it on the server. All information is stored on mysql database and the designs are stored in a javascript array. I want to be able to pass copy the entire array from javascript into php, save it in the database and than retrieve it back into javascript.

I've searched the web for this but couldnt find a working solution. Using post/get didnt work. If i print the array using javascript i get something like [object OBJECT, object OBJECT].

Is there anyway to pass arrays between javascript and php?

Thanks

share|improve this question
1  
what is the code that you have written – Satya 11 hours ago
2  
Googling a sentence verbatim from your question, Is there anyway to pass arrays between javascript and php? returns this as the top result: "How can I pass a variable from JavaScript to PHP" php.net/manual/en/faq.html.php#faq.html.javascript-variable – msanford 11 hours ago
Yes but you cannot pass from Javascript to PHP. – flov 11 hours ago
@flov You cannot pass them directly, but there are means to do so. Your comment is incorrect. – izuriel 11 hours ago
1  
@flov I know. You can pass data from Javascript to PHP, and you can pass data from PHP to Javascript. There are means and methods to do so. I've done them and I do them daily, your comment is incorrect. – izuriel 10 hours ago
show 3 more comments

2 Answers

Have a look at this, That may help=> Pass JS Array to PHP

a suggestion: Try to search stackoverflow before posting, it can save alot of time. :)

share|improve this answer
i tried that already before posting this question and it didnt work for me – Error Messages 9 hours ago

Yes, you can do that by using AJAX. http://en.wikipedia.org/wiki/Ajax_%28programming%29.

jQuery can help with that http://api.jquery.com/jQuery.ajax/.

share|improve this answer
do you have any good links for AJAX? I've tried JSON and it doesnt work. I'll try JQuery and get back to you on it, Thanks – Error Messages 9 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.