错误:第1行的解析错误:函数搜索(酸性^期待 ' STRING',' NUMBER',' NULL'' TRUE',' FALSE',' { ',' [',得到' undefined'
代码:
function search(source) {
$.ajax({
url: "index.ajax.php",
type: "POST",
cache: false,
dataType: "json",
data: { action:"search", source:source, form:$("form#main").serialize() },
success: function(data) {
//table
$('#table_data').html(data.table);
$("input[name='count']").val(data.count);
$("#time").html(data.time);
//pagination
from = Number($("input[name='start']").val());
to = (Number(data.count) > (Number($("input[name='limit']").val())+from)) ? Number($("input[name='limit']").val())+from : data.count;
if(data.count == 0) {
$('#page_info').html('<p>No results found.</p>');
$('#next').hide();
} else {
$('#page_info').html('<p>Showing '+(from+1)+' to '+to+' of '+data.count+' records in total.</p>');
$('#next').show();
}
},
error: function(data) {
$('#table_data').html('<tr><td colspan="20">Results error. Please contact admin.</td><tr>');
$("#page_info").html("<p>Load error.</p>");
}
});
}
答案 0 :(得分:0)
虽然问题不明确,但似乎您可能正在尝试将您引用的代码解析为JSON字符串。
这是无效的,会导致您在问题标题中引用错误。
JSON字符串不能包含代码;它们必须只包含数据。只要它包含代码,它就不是JSON和更多,而是JavaScript。
如果没有更多的背景,我无法就如何解决这个问题给出任何直接的建议,但我怀疑你需要改变你想要实现的目标。
答案 1 :(得分:0)
function accounts_table($load, $aid=false, $level) {
$tmp = explode(":", $level);
$level = $level ? end($tmp) : false;
$sorting_filters = get_call_sorting_filters();
$table = "";