Umesh251
Umesh251

Reputation: 108

My ajax function keeps looping

I have this ajax function. After a successful response, ajax again sends a request and this goes in loop. How Should I do a return false, If needed?

$(function () {
    $("#acts1").jstree({ 
    "html_data" : {
            "ajax" : {
                "url" : "ajax.php",
                "data" : function (n) { 
                    return { id : n.attr ? n.attr("id") : 0 };

                },

            } 
        },

        "plugins" : [ "themes", "html_data", "ui", "crrm","checkbox" ]
    })
});

Upvotes: 0

Views: 265

Answers (1)

SpYk3HH
SpYk3HH

Reputation: 22570

It would help to know the php return, but somthing else to keep in mind is its better to "echo" than return and if you are echoing a true or false, make sure to wrap it in a json_encode() so that it sends to ur ajax in a readable format

Upvotes: 1

Related Questions