提交表单数据而无需重新加载页面
我试图提交表单而不使用jQuery重新加载页面本身,但数据没有显示,表单正在重新加载,这是不需要的。
jQuery代码:
function submitFormData() { var firstval = $("#first").val(); var second = $("#second").val(); //var operator = $("#myselect option:selected" ).text(); $.post("index.php",{first:first,second:second}, function(data){ $('#results').html(data); $('#formcal')[0].reset(); }); }
这是同一页面上的HTML代码(INDEX.PHP):