1

Although I have read a few posts similar to this I cannot seem to get it working. I have the following Ajax that is called when a button is pressed.

   function refreshTab(){
           theObject = {
               getArray: function(callback) {

                   $.ajax({
                       url: 'urlGoeshere',
                       data: "",
                       type: "GET",
                       dataType: 'json',
                       success: function(data)         
                       {                                                          
                           callback.call(this,data);
                           alert("testing");
                       },
                       error: function (err)
                        {
                            alert(err.responseText)
                        }
                   });
               }
           }
           theObject.getArray(function(data) {
               javascript: console.log(data);
               for(i=0;i<data.length;i++){
                   auditHolder = auditHolder + "<tr class='gradeU'><br><td>" + data[i].Description + "</td><td style='width:100px' align='center'>" + data[i].CreatedOn + "</td><br></tr>"
                   // $('#container tbody').append("<tr class='gradeU'><br><td>" + data[i].Description + "</td><td style='width:100px' align='center'>" + data[i].CreatedOn + "</td><br></tr>");

               }
               $('#container tbody').html(auditHolder);

           });                                          
       }

The above code works perfectly in Chrome however does not work in either FF or IE. Currently using jQuery 1.4.4.

Through the alert("testing"); I found that the line that seems to break the code is

     callback.call(this,data);

Putting an alert box before it works in all browsers however only in Chrome does the alert box fire after the callback.

Thanks a lot for any help.

4

1 に答える 1