user3458266
user3458266

Reputation: 245

function does not call other function

I have a function that calls another function on success. I have used alerts as you can see and it goes up to alert "2".

On F12 press there is a 500 server error, but also I can see that my webservice does work because I see that it pulls all the data correctly in XML. Also my data: param or query string gets the correct values.

JavaScript:

function ContactView()
{
    alert("1")
    var txtSearchbox = $("#searchTextField").val();
$.ajax({
        type: "GET",
        data: param = "searchField="+txtSearchbox+"&office="+localStorage.getItem("office")+"&person="+localStorage.getItem("person")+"&user="+localStorage.getItem("user")+"&organization="+localStorage.getItem("organization"),
        contentType: "application/json; charset=utf-8",
        url: "http://msw-wsdl.company.net/mobile.asmx/ContactGet",
        dataType: "json",
        success: successContact,
        failure: function (msg) {
            console.log(msg);
        }
    });
    alert("2")   /*this is the last alert that pop's up, nothing further*/
}
/*wsdl call succeed*/
function successContact(data) {
    alert("3")
    $("#lstView_contacts").kendoMobileListView({
        dataSource: JSON.parse(data.d),
        template: $("#lstView_contact_Template").html(),
        endlessScroll: true,
        scrollThreshold: 8
    });
    window.location = "#contactsview";
}

Why is the success callback successContact not called - any ideas?

Upvotes: 0

Views: 122

Answers (1)

Iqbal Fauzi
Iqbal Fauzi

Reputation: 1571

Function successContact will get called only if it's success, and error 500 mean it's not success. The error method will get called instead which is not define on your case.

Upvotes: 2

Related Questions