0

This is my JavaScript function that does the POST

function loging() {
    $.ajax({
        url: "https://192.168.207.203:8443/e_ec_check",  
        type: "POST",  
        dataType: "json",  
        cache: false,   
        headers: {ContentType: "application/x-www-form-urlencoded"},
        body: {username: "admin", password: "admin"},
        success: function(response) {
            console.log(response);  

            if (response.auth === 1) {
                window.location.href = "https://192.168.207.203:8443/#/app/dashboard";  
            } else {
                $("#invalid").show();   
                centered($("#invalid"));

                $(window).resize(function() {
                    centered($("#invalid"));
                });

                setTimeout(function() {
                    $("#invalid").hide();
                }, 3000);
            }
        }
    });
}

<input type="button" value="submit" onclick="loging()" />
aomo
  • 1
  • 3
  • what are the errors you are getting, Or what do you expect and it is not happening? – Bosco Jul 13 '19 at 02:25
  • I used the postman software to POST is OK, but javascript always show me error and i just only set a header and two body data in the postman. this is my error pic [Imgur](https://i.imgur.com/lPrpCZU.jpg) – aomo Jul 13 '19 at 09:41
  • look at this post https://stackoverflow.com/questions/31513450/jquery-ajax-request-being-block-because-cross-origin – Bosco Jul 13 '19 at 11:06
  • https://stackoverflow.com/a/35553666/19068 – Quentin Jul 13 '19 at 17:21

0 Answers0