re1man
re1man

Reputation: 2367

jquery array to php JSON

I have various textnodes (p) and headers that I extract using jquery and store into an array :

var textnode = $(source).children("p:not(:has(img))").map(function () {
    return $(this).outerHTML();
}).get();
var headerone = $(source).children('h1').map(function () {
    return $(this).outerHTML();
}).get();

I need to take the textnode array and headerone array and pass it via ajax to a php script (which will consequently store it in mysql). Does serializeArray work in this case or could I use .stringify. Would I need to .decode this in php (version 5.3.4)?

Upvotes: 0

Views: 396

Answers (1)

bpeterson76
bpeterson76

Reputation: 12870

If you send it via jQuery Ajax, it will be automatically serialized and will be available to your PHP as a $_REQUEST array variable.

http://api.jquery.com/jQuery.ajax/

Upvotes: 1

Related Questions