jquery exit function in ajax call

Posted by Raphappa on Stack Overflow See other posts from Stack Overflow or by Raphappa
Published on 2010-12-23T05:38:59Z Indexed on 2010/12/23 5:54 UTC
Read the original article Hit count: 208

Filed under:
|

I have a javascript function. and in there, I insert a ajax call function using jquery.

depends on ajax call result, I want to exit hi function.

is there anyway to do this?

function hi()
{
    $.ajax({
            url: "/shop/haveItem",
            type: "GET",
            async:false,
            success: function(data){
                if(data == '1')
                    //exit hi() function
            }
        });

    //some executable code when data is not '1'
    ...
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery