0

I have a Site For Frontend Publishing. As it is obvious i use a form with various fields like tags and categories. I took a autosave code snippet from another answer Stack Exchange.

  setInterval(function(){
  var form = $('#Milyin-Add-Edit');
  var method = form.attr('method').toLowerCase();      // "get" or "post"
  var action = form.attr('action');                    // url to submit to
  $[method](action, form.serialize(), function(data){
    // Do something with the server response data      
    // Or at least let the user know it saved
  });
},10000);

This autosaves the title and excerpt fields of my form. But the main field which is post content field is not picked up with this snippet.

wp_editor($thispost->post_content, 'frontier_post_content', frontier_post_wp_editor_args($fpost_sc_parms['frontier_editor_height']), array('tinymce'=>true));

Changing the text on this field does not save, even after waiting for over a minute. Any change to other textarea field gets updated within few seconds as expected.

Please help out edit the js so that it autosaves the full form including the TinyMCE wp editor. Also, if someone can, then please modify this code to autosave when user has stopped typing for 5 seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.