如何在按钮单击事件中使用Jquery停止页面加载。 [英] How Can I Stop Page Load In The Button Click Event Using Jquery.
本文介绍了如何在按钮单击事件中使用Jquery停止页面加载。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里如果我按下按钮,页面正在加载,所以我不想要页面加载。我必须在中编写什么代码clickPlusButton()
,
here if i press button click, the page is loading , so i don't want page load. what code i have to write in clickPlusButton()
,
function treeview() {
var request = {};
// request.DocID = $.session.get("docID");
$.ajax({
type: Http_Post,
url: WebNav_GetTreeViewReportGenerator,
contentType: "application/json; charset=utf-8",
dataType: "json",
data: '{request: ' + JSON.stringify(request) + '}',
success: ontreeviewSuccessCall,
error: onReportGeneratorError
});
}
//On Success Call
function ontreeviewSuccessCall(response) {
try {
var strDivBody = '';
var groupFieldName = '';
$.each(response.d.ReportGeneratorData, function (key, value) {
if (groupFieldName != value.FieldNames) {
groupFieldName = value.FieldNames;
//strDivBody = strDivBody + '<table id="tbltreeview"><tbody><tr><td><label>'+value.FieldNames+'</label></td></tr></tbody></table>'
strDivBody = strDivBody + '<table id="tbltreeview"><tbody><tr><td><a önclick="clickPlusButton(' + "><input type="image" src="../Loginassets/img/add.gif" id="Add"/><label> ' + value.FieldNames + '</label></a></td><td></td></tr></tbody></table>'
} strDivBody = strDivBody + '<div class="' + value.FieldNames + '" style="display: none;"><table><tbody><tr><td><a önclick="selectReportOnFolder(' + "><label> ' + value.FieldValue + '</label></a></td></tr></tbody></table></div>'
});
$('#fld-TotalFields').append(strDivBody);
}
catch (ex) {
}
}
function clickPlusButton(groupName) {
$("." + groupName).show();
}
推荐答案
.session.get(docID);
.session.get("docID");
.ajax({
类型:Http_Post,
url:WebNav_GetTreeViewReportGenerator,
contentType: application / json; charset = utf-8,
dataType: json,
数据:' {request:' + JSON .stringify(request)+ ' }' ,
成功:ontreeviewSuccessCall,
错误:onReportGeneratorError
});
}
// 成功通话
function ontreeviewSuccessCall(response){
try {
var strDivBody = ' ';
var groupFieldName = ' ';
.ajax({ type: Http_Post, url: WebNav_GetTreeViewReportGenerator, contentType: "application/json; charset=utf-8", dataType: "json", data: '{request: ' + JSON.stringify(request) + '}', success: ontreeviewSuccessCall, error: onReportGeneratorError }); } //On Success Call function ontreeviewSuccessCall(response) { try { var strDivBody = ''; var groupFieldName = '';
.each(response.d.ReportGeneratorData, function (key,value){
if (groupFieldName!= value.FieldNames){
groupFieldName = value.FieldNames;
// strDivBody = strDivBody +'< table id =tbltreeview>< tbody>< tr>< td>< label>'+ value.FieldNames +'< / label>< / td>< / tr>< / tbody>< / table>'
strDivBody = strDivBody + ' < table id =tbltreeview>< tbody>< tr>< td><aönclick=clickPlusButton(' + >< input type = imagesrc = ../ Loginassets / img / add.gif id =添加 / ><标签> '+ value.FieldNames +'< / label>< / a>< / td>< td>< / td>< / tr>< / tbody>< / table>'
} strDivBody = strDivBody +'< div class = ' + value.FieldNames + ' style = display:none; >< table>< tbody>< tr>< td><aönclick= selectReportOnFolder(' +>< label>' + value.FieldValue + ' < / label>< / a>< / td>< / tr>< / tbody>< / table>< / div>'
});
.each(response.d.ReportGeneratorData, function (key, value) { if (groupFieldName != value.FieldNames) { groupFieldName = value.FieldNames; //strDivBody = strDivBody + '<table id="tbltreeview"><tbody><tr><td><label>'+value.FieldNames+'</label></td></tr></tbody></table>' strDivBody = strDivBody + '<table id="tbltreeview"><tbody><tr><td><a önclick="clickPlusButton(' + "><input type="image" src="../Loginassets/img/add.gif" id="Add"/><label> ' + value.FieldNames + '</label></a></td><td></td></tr></tbody></table>' } strDivBody = strDivBody + '<div class="' + value.FieldNames + '" style="display: none;"><table><tbody><tr><td><a önclick="selectReportOnFolder(' + "><label> ' + value.FieldValue + '</label></a></td></tr></tbody></table></div>' });
这篇关于如何在按钮单击事件中使用Jquery停止页面加载。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文