Step 239. Library jQuery. The use of expansion modules. Extension library jQuery UI. Form. Widget Jeditable (continued)

In this step, we consider sending data to the server, and removing htmlmarkup.

The material of this step is based on http://it-route.ru/jeditable_manual_ru/.

On the server the data is sent by the method POST:

 id=elements_id&value=user_edited_content 

There is the possibility of renaming the sent parameters. For example, you need to go the next line:

 elementid=elements_id&newvalue=user_edited_content 

For this you need to add two parameters:

 $(document).ready(function() { $('.edit').editable('http://www.example.com/save.php', { id : 'elementid', name : 'newvalue' }); }); 

If the contents of the elements of the class edit_area, for example, contains data with markup type Wiki, Markdown, and want to edit only the text in the markup, not the original htmltext content block. For this you can use loadurl, which defines a urlfrom which data is retrieved for editing:

 $(document).ready(function() { $('.edit_area').editable('http://www.example.com/save.php', { loadurl : 'http://www.example.com/load.php', type : 'textarea', submit : 'OK' }); }); 

In this example load.php should return the contents of the block without the htmlmarkup. However, save.php returns the text with html-markup. After saving, the browser displays the data that is returned to the script save.php. There is another option — you can send the markup in parameter data.

In the next step we will continue to examine this question.

The previous step the Content of the Next step