1

There are many related questions and answers (1), but I can't solve my problem with ajax request. It works perfect on all browsers excepting IE. IE won't perform success block.
script:

 <script>
  $.ajax({
    type : 'post',
    async : false,//testing for IE
    cache : false,
    dataType : 'text',
    url : '${pageContext.request.contextPath}/pages/recordInsert',
    data : $('#newPlace #place').serialize(),
    success : function(data, textStatus) {
        console.log('record inserted');
        loadPlaces();//reloading data in div
    }
});
</script>

And controller:

@RequestMapping("pages/recordInsert")
public ResponseEntity<String> placeInsert(@ModelAttribute("place") Place place) { 
@SuppressWarnings("unused")
///some useful code
    Integer temp = placeService.insertPlace(place);
    return new ResponseEntity<String>(HttpStatus.OK);
}

But when i start in IE Developer Tools (F12) all works perfect in IE too. Versions: IE 9, jquery 2.1.4

Community
  • 1
  • 1
zond
  • 1,213
  • 1
  • 19
  • 32

2 Answers2

1

In Internet Explorer 9 (and also in 8), the console object is only exposed when the developer tools are opened for a particular tab. If you hide the developer tools window for that tab, the console object remains exposed for each page you navigate to. If you open a new tab, you must also open the developer tools for that tab in order for the console object to be exposed.

So you have to change your code to something like:

if (console in window) {
  console.log('Record inserted!');
}
Bud Damyanov
  • 24,155
  • 6
  • 37
  • 49
0

Replace this line:

console.log('record inserted');

with

if (window.console) console.log('record inserted');
Martin Brown
  • 22,802
  • 13
  • 71
  • 107