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, a request is usually sent on a button click.

Data is sent to a server script in the body of an 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 a connector-based script, the simplified data transfer protocol can be used.

Additionally, you can pass extra parameters as a GET request:

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

Here is what you might have in a 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