Intermediate

Saving Data with Ajax Helper

Webix Ajax helper helps save component data on demand as well as form and input data.

Note that DataProcessor isn't initialized this time and you need to catch the necessary events (add, edit, delete) yourself. For forms saving request is usually send on button click.

Data is sent to server script in the body of Ajax POST request:

webix.ajax().post("myscript", params, callback);

Note that

webix.ajax().post("my_script", {id: some, name: some, address:some }, callback);
webix.ajax().post("my_script", form.getValues(), callback);

If combined with connector-based script, simplified data transfer protocol can be used.

Additionally, you can pass extra parameters as GET request:

webix.ajax().post("data/load.php?id=1&action=update", {prop1:value1, prop2:value2} 
    function(text, data){
    ...//callback
});

There you'll have in server-side script:

$id = $_GET['id'];
$action = $_GET['action'];
$prop1 = $_POST['prop1];
$prop2 = $_POST['prop2];

Learn more about the possibilities of Webix Ajax interface.

Back to top