JavaScript call hangs app

Client is Appcelerator Titanium. I have created a sample project that recreates this problem.

Hello,
Yes, as far as I know Appcelerator Titanium has different env where JS is running and we have a patch for our JS-SDK which overrides some methods and gets it working, did you try this: https://github.com/Backendless/backendless-appcelerator ?
Regards, Vlad

@vladimir-upirov, @kam-rezvani uses a raw REST request in his code, the patch for Appcelerator applies to our JS SDK uses in that platform so it is irrelevant here.

I am trying both REST and JavaScript. I tried it with AppC patch and the app still hangs. Will send JS project link to support@backendless.com

I’ve run your app, but there was some mistakes in code

  1. when you use JS-SDK you do not need to encode url components, so you have to change this:

    — var whereClause = ‘ServletName%20%3D%20%27’ + environ + ‘%27’;
    +++ var whereClause = “ServletName='” + environ + “'”;
    var queryBuilder = Backendless.DataQueryBuilder.create().setWhereClause(whereClause);

  2. as result of Backendless.Data.of(“TableName”).find(queryBuilder) you get Promise which will be resolve with already parsed data, so you don’t need to parse it manually

    ---- Backendless.Data.of(“TableName”).find(queryBuilder).then(function (e) {
    var parsedData = JSON.parse(e.text);

    +++ Backendless.Data.of(“TableName”).find(queryBuilder).then(function (parsedData) {

  3. in “catch” callback you will get JS Error object, so you should use

    .catch(function (error) {
    alert('ERROR: ’ + error.message + ’ CODE: ’ + error.code);
    })

this docs should help you Search with the Where Clause - Backendless SDK for JavaScript API Documentation

Regards, Vlad

Thank you for the fix Vladimir. Issue resolved.