网络Web服务。以下代码使用JS附加到我的母版页。当我运行ajax调用时,它似乎在成功函数结束时刷新整个页面。而不是某个特定的部分。我已经尝试使用两种方式,表单+输入提交,并与点击功能的正常按钮。Ajax刷新整个页面而不是特定部分
$.ajax({
url: 'service url',
data: { LookupParameter: somevariable },
method: 'POST',
dataType: 'xml',
asynch: false,
cache: false,
success: function (data) {
var xmldata = $(data);
//dom manipulation code
},
error: function (e) {
}
});
将以下代码嵌入到body标签中。但不在内容占位符中。
<form itemscope itemtype="http://schema.org/LocalBusiness" id="form1" runat="server">
<span class="input-group-addon borderRadiusZero" id="basic-addon1">
<span class="glyphicon glyphicon-question-sign"></span>
</span>
<Input ID="txt_lookup_pincode" type="number" class="form-control" min="111111" max="999999" placeholder="Enter Your Pincode" />
<span class="input-group-btn ">
<button id="LookupServicesa" class="btn btn-primary borderRadiusZero" onClick="HomeCheckDeliverableAreas();" style="height:100%;">Submit</button>
<input id="LookupServices" class="btn btn-primary borderRadiusZero" style="height:100%;" type="submit" value="submitM" />
</span>
添加此代码'location.reload();'在ajax成功。 – purvik7373
@ purvik7373 OP要*不*重新加载页面 –