Thabo Ketlhaetse
Thabo Ketlhaetse

Reputation: 58

Querying azure mobile services with javascript

I am working on a mobile application using apache cordova.. I have a javascript file that reads data from an azure mobile service and persists it onto the local SQLITE database..

i have a function that is meant to query the azure mobile service but it gives me an error -"cannot read propert 'take' of undefinedType". The function is as follows

function refreshQuestionsTable() {
        alert("questions refreshing");
     var query = QuestionsTable.take(100).read().done(function (results) {
        alert(results.length); //see how many records were returned
        for (var i = 0; i < results.length; i++) {

    alert(results[i].question); //display the question returned
    commitQuestions(results[i].question_id, results[i].client_ref, results[i].question_set, results[i].question_dept, results[i].question, results[i].question_branch, null);

        }

    },function (err) {
        alert("Error: " + err);
    });  

} 

Upvotes: 0

Views: 76

Answers (1)

Chris Anderson
Chris Anderson

Reputation: 8515

It looks like your client instantiation piece is wrong.

var client = new MobileServiceClient('feedbackmaster.azure-mobile.net/', 'oLMEOExWGFolBhpyYpTFkqvKuLNlyL91');

You had a ';' at the end of your URL for some reason. You should also do a .where() clause that is universally true. Take should work off of that.

Upvotes: 1

Related Questions