AJAX PUT call to pass parameters in BODY


#1

I am just trying (with 5.x) to do a very simple AJAX POST, using the example JavaScript ‘AjaxPost’.
I have changed the button click method to

btnAjax.onclick = function() {
var params = {}
req = Ajax(“http://localhost:8080/servoy-service/velocity/StaffHR/api_timesheet/”, “PUT”, “PayrollNo=123”, done);
};

but my page is returning ‘undefined’ (I have also tried GET & POST)
[My page is using something called Velocity in a product called Servoy to do REST web services]

Using another program
https://mmattozzi.github.io/cocoa-rest-client/
I am able to get my page to get the parameter(s) passed in the BODY (see attached screen shot…very bottom is my Servoy console output of what the page returns as sent

How can I make the AJAX call send multiple parameters in the BODY using PUT??


#2

AppStudio’s Ajax function is a wrapper for the jQuery Ajax() function.

https://api.jquery.com/jquery.ajax/

You might get some ideas there. Also, make sure that ‘done’ is the name of a function in your app. If not, you’ll get undefined.


#3

Thanks
I’ve looked at that URL & tried some things, but it didn’t help.
Also, ‘done’ is a function in my code and is correctly handling returned ‘req’