Reynaldo Libutan
Posts: 0
Joined: Fri May 01, 2015 6:54 am

How to use $.ajax instead of service?

I want to use jquery $.ajax() because I am experiencing difficulties with POSTing complex object via JSON through your service wrapper.

I tried the usual $.ajax() but I am stopped by cross-domain violation. Is there something I need to do to be able to use $.ajax() using Appery proxy without using the service wrapper?

Reynaldo Libutan
Posts: 0
Joined: Fri May 01, 2015 6:54 am

How to use $.ajax instead of service?

Any news on this?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

How to use $.ajax instead of service?

Hi -

Please take a look in our documentation how proxy URL should look like in the app: https://devcenter.appery.io/documenta...

Here is a sample code of a AJAX request from our Database:

pre
code
$.ajax({
type: "GET",
beforeSend: function(request) {
request.setRequestHeader("X-Appery-Database-Id", "5166b6a8e4b055aafd1f2167");
},
url: "https://api.appery.io/rest/1/db/collections/todo",
data: {
where: JSON.stringify({Name:"name2"})
},
dataType: "json",
success: function(response) {
console.log("Successfully loaded");
},
error: function(xhr, ajaxOptions, thrownError) {
console.log("Load error: " + xhr.status + " " + xhr.responseText);
}
});

/code
/pre

Return to “Issues”