views:

234

answers:

2

Hi, I need a little help to figure out why the following code does not work on google chrome 5/windows xp. It works well on all other browsers (IE, FF, Safri, Opera etc). Can someone shed some light around this?


    /* AJAX Request */
jq("#a-post-request").unbind("click").bind("click", function(e){ 
    //jq("#loading").css({"display":"block"});
    jq.ajax({
        url: "search_data_table.html",
        type: "get",
        cache: false,
        error: function(){alert ("No data found for your search.");},
        success: function(data){
            jq("#search-results-table tbody").empty().append(data);
            jq("#search-results").css({"display":"block"});
            jq("#search-results-table").trigger("update"); // this one is for the table sorter plugin
            // set sorting column and direction, this will sort on the first column.
            var sorting = [[0,0]];// this one is for the table sorter plugin
            // sort on the first column .
            jq("#search-results-table").trigger("sorton",[sorting]);// this one is for the table sorter plugin
            e.preventDefault();
        }
    });
});

Many thanks, Racky

+1  A: 

The only thing I notice here is a missing

dataType: "html"

or whatever. Else, see comment.

jAndy
Yes, even though jQuery will do its magic to determine the correct data type of the response, it's surely a good idea to settle it right away, also on performance considerations.
Ain
Hey, sorry about that. Can you help me how to find what error it is on chrome. I know where to find it in FF. What I am expecting is when I click in a button ("#a-post-request") the table data from the file ("search_data_table.html") is appended to the table body (tbody) and displayed on the page thru ajax. I have tried dataType but no luck yet!
racky
have a look into the developers `console` from chrome, any output in there?
jAndy
and the console has no errors/warnings. see my comment below please
racky
A: 

Hey, so a little clue to the error would be to look at the developer tools page, and see if you're getting any errors with the XHTTPRequest.

My guess though, as I've run into this before, is that chrome is running into security issues, and not allowing the request to work.

As for how to fix it, it's going to depend on the problem. Let us know what you find in the developer tools!

Jesse
is there a firebug like tool for Chrome?
racky
alright, if i alert data it's empty and if I say append("sometext") this works. what could be the problem?data is supposed to have the following;<pre><code><tr> <td>aol123</td> <td>John</td> </tr> <tr> <td>aol435</td> <td>mCare</td> </tr> <tr> <td>aol222</td> <td>Joel</td> </tr></code></pre>
racky
Hope I have given enough info about the problem
racky
Chrome (and all webkit browsers) has a built-in tool for looking at developer info, it's actually at least as powerful as firebug, if not better. It is under view->developer->Developer Tools on a mac.if data is empty, it points to there being something in the way of being able to access the script properly. To check to make sure the ajax call is actually loading the right page, you can check for the page under the "resources" tab of the developer tools. You'll also want to make sure you open the console and check for warnings or errors there.
Jesse