I have a safecracker entry that I would like to change the status via jquery onClick or Submit? For example, I have one button that would be "save and preview" that onClick would change the status to "preview". There would be another button onClick button "Submit for Review" that would change the status of the same form to "pending". Is this possible?
1 Answer
You can do it easily with the Mefu
Just create a template having mefu tag OR just put this code within a template like tempgrp/tempname:
{exp:mefu:save}{/exp:mefu:save}
and put this JQuery code to post the entry status to above template:
$.post("temp_grp/temp_name", { "[entry_id]:staus": "Open", mefu: "submit" }, function(data){
alert('status updates')
} );
For the same purpose, you can write the UPDATE query to update the entry status.
For the preview, use the load() of JQuery like:
$.post("temp_grp/temp_name", { "[entry_id]:staus": "Open", mefu: "submit" }, function(data){
$('#container_id').load('preview_template');
} );