1

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.

hansTheFranz
  • 2,511
  • 4
  • 19
  • 35

1 Answers1

1

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

Bajal
  • 5,487
  • 3
  • 20
  • 25
  • Thanks for your answer but I do not have problems with other `console.log statements`. They all work except of this one. when I put a `console.log` above the function it gets displayed but when I use it in `success` it doesn't. – hansTheFranz Jul 17 '17 at 01:45
  • I tried to reproduce the problem, but unable to - I'm on El Capitan and Safari 10.1.1.. Just curious, can you try `alert(console)` and see if it alerts `[object Console]` – Bajal Jul 17 '17 at 01:54
  • Yes I get an alert `[object Console]` when I `alert(console)` after success in the Ajax call – hansTheFranz Jul 17 '17 at 01:57
  • Sorry, could not be of help here. I did play with a bit, but works fine for me whatever I do. – Bajal Jul 17 '17 at 10:43
  • Yes, I think its just a small bug, I will close this for now, If anybody experience the same Problem please leave a comment. Probably will be fixed on the next update.... @bajal thanks for your help really appreciate that you tried to reproduce the problem and wanted to help out :) – hansTheFranz Jul 17 '17 at 12:19
  • I have the same problem- not sure what it is, I see a bunch for 304 logs – Johnny G. Nov 25 '19 at 20:23