是否可以使用 getJSON 传递 2 个不同的数组?
$.getJSON('<?php echo $_SERVER['SCRIPT_NAME']; ?>', {
ajax: 'ajax_article_partlist' ,
parent_article: $('#selected_article').val()
},
function(data) {
$('#articles').html('');
$('#article_table').show('slide');
for (var i = 0; i < data.length; i++) {
$('#articles').append("<p>"+data[i]+"</p>");
}
});
这是我的请求,在 php 端我回显和数组。但是我现在得到了第二个数组,我必须传递相同的请求。那有可能吗,还是我必须制作一个新的getJSON?
php代码:
case 'ajax_article_partlist' :
header('Content-type: application/json');
$form->addFormField(new FW_HTML_Form_Request('parent_article'));
$form->resolveRequest();
$parent_article = $form->getValue('parent_article');
$part_list =$db_obj->getFormatedPartList($parent_article);
$db_obj->checkArticleProgram($parent_article);
echo json_encode($part_list);
include($_SERVER['DOCUMENT_ROOT'].'/inc/includes/cms.footer.inc');
exit;
break;