1 回答

TA貢獻(xiàn)2012條經(jīng)驗 獲得超12個贊
您能否從服務(wù)器端遵循以下方法并使用以下帶有數(shù)據(jù)類型的ajax方法json來接收多個值
$.ajax({
url : "myurl.php",
method : 'POST',
datatype : 'json',
data : {
params1 : value1,
params2 : value2
},
success : function(datas) {
$("#elem1").html(data.html1);
$("#elem2").html(data.html2);
}
});
myurl.php 服務(wù)器端腳本應(yīng)該如下
<?php
$return = array();
$html1 = '';
$html2 = '';
$html1.='<h2>This is a test element</h2>';
$html2.='<h2>This is another test element</h2>'
$return['html1'] = $html1;
$return['html2'] = $html2;
echo json_encode($return); exit;
?>
- 1 回答
- 0 關(guān)注
- 120 瀏覽
添加回答
舉報