您可以尝试以下方法:
onclick="callAjax() return false;">
或这一个:
function callAjax(e){ //<-------pass the event e.preventDefault(); // <-----add this to prevent the default behavior $.ajax({..... });}根据要求完成ajax调用:
function callAjax(){ $.ajax({ url: "returnMe", type:"post", dataType: 'json',// data:{ids:JSON.stringify(idList), option:option, id:id} success: function(data) { console.log(data); //<-----this logs the data in browser's console }, error: function(xhr){ alert(xhr.responseText); //<----when no data alert the err msg } }); }


