Home $.ajax deferred issue: Object doesn't support property or method 'then'
Reply: 0

$.ajax deferred issue: Object doesn't support property or method 'then'

user1695 Published in July 17, 2018, 3:05 pm

I'm trying to chain some ajax calls but I'm getting an "Object doesn't support property or method 'then'" error. I'm trying to send a chunk of data in one call, (hopefully) getting a unique value back, then sending that unique value to another call.

Here are my methods...

var fetchDocID = function() {   
            log('fetchDocID: ');
            // ajax call
                url: myUrl,
                method: 'POST',
                contentType: 'application/json; charset=utf-8',
                beforeSend: function (request) {
                    request.setRequestHeader("Authorization", "Negotiate");
                crossDomain: true,
                dataType: 'json',
                processData: false,
                async: true,
                cache: false,
                data: '{\"Text\": \"'+myText+'\"}',             
                error: function (xhr, textStatus, errorMessage) {
                    console.log("fetchDocID Error: " + errorMessage);

var fetchSuccess = function(response){
        myDocID = response.documentID;
        console.log("myDocID: "+ myDocID);
        var qryDocID = myNewUrl + myDocID;
        return $.ajax(qryDocID);

I'm trying to use the following to chain it all together. This is where I'm getting the error...

    console.log("fetchDocID: " + JSON.stringify(response));

I probably haven't had enough coffee today. But what am I doing wrong?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310885 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO