当我点击按钮它没有进入Ajax功能 [英] When I Click On Button It Is Not Entering Into The Ajax Function

查看:251
本文介绍了当我点击按钮它没有进入Ajax功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述









 alert(document.getElementById ('<% = hdnUserId.ClientID %> ')。value); 
$(。save-job)。hide();
$(。email-to)。hide();
$(。share-link)。hide();

/ *显示函数* /
$(#s-job1)。click(function(){

alert(document.getElementById('< span class =code-pagedirective><% = hdnUserId.ClientID %> ')。value);
$( #save-job1)。hide();
$(#email-to1)。hide();
$(#share-link1)。hide();
var dNow = new Date();
var userid = $('<% = hdnUserId.ClientID %> ')。val();
var jobid = $(。head-links> h2)。attr(id);
var saveddate = dNow。 getFullYear()+' - '+(dNow.getMonth()+ 1)+' - '+ dNow.getDate()+''+ dNow.getHours()+':'+ dNow.getMinutes();
$ .ajax({
类型:POST,
contentType:application / json; charset = utf-8,
url:JobResult.aspx / Insert_Data,
数据:{'userid':'+ userid +','jobid':'+ jobid +','savedate':'+ savedate +'},
dataType:json ,
async:true,
成功:函数(响应){
$('<% = hdnUserId.ClientID < span class =code-pagedirective>%> ')。val(''); $(。head-links> h2)。attr(id); dNow.getFullYear()+' - '+(dNow.getMonth()+ 1)+' - '+ dNow.getDate()+''+ dNow.getHours()+':'+ dNow.getMinutes();
alert(记录保存成功.. !!);

},
错误:function(){

alert(Error);

}
});


});
}

});











ajax函数没有调用请告诉我cahnges是否有任何修改

解决方案

(。save-job) .hide();

( 电子邮件到 )隐藏();

(。份额链路)隐藏();

/ *显示功能* /


hi,



alert(document.getElementById('<%=hdnUserId.ClientID %>').value);
        $(".save-job").hide();
        $(".email-to").hide();
        $(".share-link").hide();

        /* Show function*/
        $("#s-job1").click(function () {

            alert(document.getElementById('<%=hdnUserId.ClientID %>').value);
            $("#save-job1").hide();
            $("#email-to1").hide();
            $("#share-link1").hide();
            var dNow = new Date();
            var userid = $('<%=hdnUserId.ClientID %>').val();
            var jobid = $(".head-links > h2").attr("id");
            var saveddate = dNow.getFullYear() + '-' + (dNow.getMonth() + 1) + '-' + dNow.getDate() + ' ' + dNow.getHours() + ':' + dNow.getMinutes();
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "JobResult.aspx/Insert_Data",
                data: "{'userid':'" + userid + "','jobid':'" + jobid + "','savedate':'" + savedate + "'}",
                dataType: "json",
                async: true,
                success: function (response) {
                    $('<%=hdnUserId.ClientID %>').val(''); $(".head-links > h2").attr("id"); dNow.getFullYear() + '-' + (dNow.getMonth() + 1) + '-' + dNow.getDate() + ' ' + dNow.getHours() + ':' + dNow.getMinutes();
                    alert("Record saved successfully..!!");

                },
                 error: function () {

                    alert("Error");

                }
            });


        });
    }

});






ajax function is not calling please tell me cahnges if any modifications

解决方案

(".save-job").hide();


(".email-to").hide();


(".share-link").hide(); /* Show function*/


这篇关于当我点击按钮它没有进入Ajax功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆