开发者

jquery array to php JSON

开发者 https://www.devze.com 2023-03-15 22:28 出处:网络
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 () {

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 = $(开发者_C百科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)?


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号