ajax html页面传参数,jQuery AJAX:如何将大型HTML标记作为参数传递?
如何使用jQuery AJAX將大型HTML標(biāo)記數(shù)據(jù)傳遞給我的PHP?當(dāng)我收到結(jié)果時(shí),這是錯(cuò)誤的。
jQuery AJAX代碼:
$('#saveButton').click(function() {
// do AJAX and store tree structure to a PHP array
//(to be saved later in database)
var treeInnerHTML = $("#demo_1").html();
alert(treeInnerHTML);
var ajax_url = 'ajax_process.php';
var params = 'tree_contents=' + treeInnerHTML;
$.ajax({
type: 'POST',
url: ajax_url,
data: params,
success: function(data) {
$("#show_tree").html(data);
},
error: function(req, status, error) { }
});
});
treeInnerHTML實(shí)際值:
?Root node 1
?Child node 1
?Child node 2
?Root node 2
從我的show_tree div返回結(jié)果:
總結(jié)
以上是生活随笔為你收集整理的ajax html页面传参数,jQuery AJAX:如何将大型HTML标记作为参数传递?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: html一张图片用两种滤镜,HTML图片
- 下一篇: body onload 控制窗口大小 h