hansTheFranz
hansTheFranz

Reputation: 2570

Alert() working but console.log() is not in Safari (iOS)

Before you start to read: Its a Safari related Issue with Chrome it just works fine, so its not a general Problem but more OS related.

Im currently doing an Ajax call and I already started to pull my hair out because I was neither getting a log in the console for success or error in an Ajax call. I added a alert("test") and I finally got a message.

So now my question is why console.log() is not working but alert() is. I found this post, but there its the opposite of what I have. Anybody can explain what I did wrong? Here is the code:

function AjaxFormSubmit(){
event.preventDefault() 
$.ajax({
    headers: { "X-CSRFToken": getCookie("csrftoken") },
    url :"/about/",
    type : "POST", 
    data :  1,
    dataType: "html",
    success : function(data) {
        alert("test");
        console.log('Success!');
    },
    error : function(xhr,errmsg,err) {
        console.log("fail");
    }
});

Im using Safari on Mac Sierra 10.12.5, never had this Problem, other console.log statements just work fine. Any thoughts appreciated.

Upvotes: 1

Views: 2091

Answers (1)

Bajal
Bajal

Reputation: 5986

First, make sure your developer menu is enabled in Safari preferences ( Cmd + , )

enter image description here

AFter this, press Cmd + shift + c to bring up the developer console. Click on the 'console' tab and you should see your message.

enter image description here

Upvotes: 1

Related Questions