.click .submit没有在Ipad safari中工作?

时间:2014-07-15 07:32:10

标签: jquery jquery-mobile

$(document).on('click', '#btnlogin', function(e) {

    var status = navigator.onLine ? 'online' : 'offline';

    if (status === 'offline') {
        alert("There is some issue with your internet connection! Try Again.");
        return;
    }

    e.preventDefault();

    // Get some values from elements on the page:
    var $form = $("#loginForm"),
        username = $form.find("input[name='username']").val(),
        password = $form.find("input[name='password']").val();

    sessionStorage.clear();

    $.post(loginurl, {username: username, password: password}, function(response) {

        if (response.session_id === null) {
            alert("Please enter correct credentials!");
            return;
        }

        console.log(response.session_id);
        sessionStorage.setItem("sessionid", response.session_id);

        $.post(getformurl + '' + module_namecase, {
            session_id: sessionStorage.sessionid
        }, function(data) {

            if ($('#checkbox-1ab').is(':checked')) {
                // save username and password
                localStorage.setItem("username", $form.find("input[name='username']").val());
                localStorage.setItem("password", $form.find("input[name='password']").val());
                localStorage.setItem("checkBoxValidation", $('#checkbox-1ab').val());


            } else {
                localStorage.removeItem("username");
                localStorage.removeItem("password");
                localStorage.removeItem("checkBoxValidation");

            }

            // $('.createcasedata').html(getHtml(data));

            localStorage.setItem("myformdata", getNewHtmlMobile(data));


        })
        .error(function()
        {
            alert("Issue with login!");
        });


        $.mobile.changePage("#two", {
            transition: "pop",
            reverse: false,
            changeHash: false
        });
    });
});

此代码不适用于IPad safari浏览器我该怎么做才刷新页面试过。提交一切。

请帮忙

0 个答案:

没有答案