by Ange Tuteur September 1st 2015, 2:32 pm
To do anything like that, you'd need to utilize AJAX. This is an example of how you could update the content of a post :
- Code:
$.post('/post', {
subject : 'Topic title',
message : 'Message content',
mode : 'editpost',
p : 'post_id',
post : 1
});
You'd need to replace post_id with a valid post identifier. ( e.g. 1, 2, 3.. ) Furthermore, for this example to work you'd need to disable the security option "disallow unofficial forms to post on the forum" via General > Security.
If you want to get past that you need to first send a GET request to return the form data. For example :
- Code:
$.get('/post?mode=editpost&p=1', function(data) {
var form = $('form[name="post"]', data).serialize(); // get the serialized form data
console.log(form); // view data in the console
});
You can then proceed to manipulate the data as needed and then submit a POST request to update the data.