Alfred Butler
Posts: 0
Joined: Wed Sep 18, 2013 12:35 pm

AJAX Parse error: Status 200: Unable to parse JSON string

I have been battling this issue with a AJAX call. And from what i can determine via
the internet is that the parse from jquery is not working.

Don't know.

I do know these items:

  1. my JSON data going out is good.

  2. I have tested my server correctly by running all my REST tests.

  3. The server does not get the network request using my JavaScript AJAX call.

  4. If i remember correctly, I did at one time use the appery.io service set up and got a successful network call. I think I did.

    Then i switched to my "roll your own" AJAX calls.

    There seems to be some posts that say the jquery V1.8+ needs jquery.validate.js as opposed to using jquery.validate.min.js.

    So questions.

  5. I wouldn't mind using appery.io AJAX api, if you got one. You got docs?
    I need control of data being formed as well as the response.

  6. If indeed yours works, and i want to roll my own....what is my responsibility in doing this? Do I need to locate some jquery libs and replace them?
    This could be very tedious, especially after downloading the code and testing.

    Oh and i am working out of Android downloaded code and running inside of Android Studio from JetBrains.

    Regards Al

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

AJAX Parse error: Status 200: Unable to parse JSON string

How did you define the Ajax request? Did you set up a REST service in Appery.io?

Alfred Butler
Posts: 0
Joined: Wed Sep 18, 2013 12:35 pm

AJAX Parse error: Status 200: Unable to parse JSON string

i did set a appery service once. But got confused on the return data and how to access it. So I rolled my own.

Like i said, the server doesn't break at all so apparently the ajax is parsing the data BEFORE it goes out. And then I stumbled on the internet comments about jquery parsing.

Here is a snippet:

var request = {
url: uri,
type: method,
contentType: "application/json; charset=UTF-8",
accepts: "application/json",
cache: false,
async:false,
dataType: 'text json',
//data: JSON.stringify(data),
data: {query: json_data_out},
//processData:false,
//traditional:true,
beforeSend: function (xhr) {
//xhr.setRequestHeader("Authorization",
// "Basic " + btoa(self.username + ":" + self.password));
},
error: function(jqXHR,status,errorThrown) {
//console.log("ajax error " + jqXHR.status);
alert("error: ajax status " + jqXHR.status);
alert("error: ajax errorThrown " + errorThrown);
//alert("error: ajax response Text " + jqXHR.responseText);

Code: Select all

             } 
         }; 
         return $.ajax(request); 

I will be glad to use your service.js set up but need some guidance on how to trap for the data so I can do what i need to.

Thanks Al

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

AJAX Parse error: Status 200: Unable to parse JSON string

We can help if you want to define the service via Appery.io service editor. I hope you understand, but doing it directly with JavaScript is outside the scope of our support.

Alfred Butler
Posts: 0
Joined: Wed Sep 18, 2013 12:35 pm

AJAX Parse error: Status 200: Unable to parse JSON string

Alright. I'll go back and set it up.
Probably over the weekend.

Thanks Al

Alfred Butler
Posts: 0
Joined: Wed Sep 18, 2013 12:35 pm

AJAX Parse error: Status 200: Unable to parse JSON string

I am stuck in your service interface.

I am trying to describe this JSON data. (The request)

How you do this in the interface

{
"amount" : "12.00",
"account":
{
"siteuser" : "1774323232",
"password" : "1007232323",
"clientversion" : "1.0",
"sendtextmessage" : "true",
"language" : "en",
"appname" : "Android;OS4.2",
"immediate" : "true",
"product" : "1"
}

}

If amount is one parameter
Then the Account is a "add level" ???
And after that I then add all of those parameters

it's a PUT but i don't that matters

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

AJAX Parse error: Status 200: Unable to parse JSON string

Hello! Yes, you have two parameters "amount" and "account". For "account" click "add level" and add other parameters.

Alfred Butler
Posts: 0
Joined: Wed Sep 18, 2013 12:35 pm

AJAX Parse error: Status 200: Unable to parse JSON string

Ok

I double checked to make sure all is well with the server and my JSON data.
My tests, using the Chrome plugin Postman says all is well.
So it's functioning.

In Appery.io I receive this:
{
"status":"403 Forbidden",
"url":"http://xx.xx.xx.xx/mwallet/rest/cashi...",
"response":""
}

If you need the REAL ip address I can send it to you privately or you can log into my account and do the test yourself.

This is going well but also remember that the data i am using in the JSON request, needs to be BASHED with different values. So obviously the hard coded examples will work but I'll need you to show me via the Appery API on how to get at the data or at least expose the variable that holds it.

I'm sure it will be exposed somewhere.

Thanks al

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

AJAX Parse error: Status 200: Unable to parse JSON string

Please send screenshot with settings at a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and share the project.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

AJAX Parse error: Status 200: Unable to parse JSON string

Hello,

It looks like you should add authentication key to the service URL if you want to execute put queries. Do you have any API docs for your service?

Return to “Issues”