admin管理员组

文章数量:1291365

I am using jquery and jstree plugin to load some images when clicked on a jstree node. It looks like when I click a jstree node, it first checks the cache and if not in cache, noghting happens. I have to click the node again to load it from the server. (if the images in cache, first time click on the node works.)

So, the behavior is not consistent for the end user. The first click on the jstree node, I should go to the server to retreive the image and put it in a div. I've been looking at this for awhile now, I couldn't e up with any solution.

I am reaching out this munity, maybe someone has seen this before and can help.

$(document).ready(function() {
    $("#div_tree").jstree({
        "xml_data": {
            "ajax": {
                "url": "tree.xml"
            },
            "xsl": "nest"
        },
        "plugins": ["themes", "xml_data", "ui", "types"]
    }).bind("select_node.jstree", function(event, data) {
        var node_id = data.rslt.obj.attr("id");
        if (node_id = "tree_a") {
            $("#mydiv").html(myPic1);
        }

Is there a quick way to disable jquery cache, so that everytime I click on a jstree node, I should get the images from the server.

I am using jquery and jstree plugin to load some images when clicked on a jstree node. It looks like when I click a jstree node, it first checks the cache and if not in cache, noghting happens. I have to click the node again to load it from the server. (if the images in cache, first time click on the node works.)

So, the behavior is not consistent for the end user. The first click on the jstree node, I should go to the server to retreive the image and put it in a div. I've been looking at this for awhile now, I couldn't e up with any solution.

I am reaching out this munity, maybe someone has seen this before and can help.

$(document).ready(function() {
    $("#div_tree").jstree({
        "xml_data": {
            "ajax": {
                "url": "tree.xml"
            },
            "xsl": "nest"
        },
        "plugins": ["themes", "xml_data", "ui", "types"]
    }).bind("select_node.jstree", function(event, data) {
        var node_id = data.rslt.obj.attr("id");
        if (node_id = "tree_a") {
            $("#mydiv").html(myPic1);
        }

Is there a quick way to disable jquery cache, so that everytime I click on a jstree node, I should get the images from the server.

Share Improve this question edited Aug 12, 2012 at 11:42 hippietrail 17k21 gold badges109 silver badges178 bronze badges asked Jul 12, 2012 at 19:13 Mike DudeMike Dude 1512 gold badges4 silver badges16 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

Yes, you can use ajaxSetup.

$.ajaxSetup({
    cache: false
});
$(document).ready(...

本文标签: javascriptdisabling cache on jqueryStack Overflow