jquery - ajaxSubmit does not reload page after first request (in CakePHP) -
i'm creating cms has page edit section. i'm trying create preview function. works fine on first attempt, if change text , preview again, preview old version. appears quickly. it's if ajaxsubmit function doesn't bother reloading page.
i tried round changing url each time (by adding on timestamp end), made no difference. i'm using jquery, cakephp , fck editor.
here's have:
<script type="text/javascript"> $('#page_modal').jqm(); $('#preview_btn').click(function(e){ // current page content fck iframe var oeditor = fckeditorapi.getinstance('pagecontent'); var newcontent = oeditor.getdata(); $('#pagecontent').html(newcontent); // submit form via ajax var d=new date(); var t=d.gettime(); var thisurl = '/admin/pages/preview/' + t.tostring(); $('#ajaxform').ajaxsubmit({ url: thisurl, error: function(xmlhttprequest, textstatus, errorthrown){ alert(textstatus); }, success: function(responsetext){ $('#page_modal').jqmshow().find('#page_modal_content').html(responsetext); } }); e.preventdefault(); }); </script>
as said, works fine first time, on subsequent calls content not updated. can suggest anything?
try marking view (/admin/pages/preview) no cache. in actual view put:
<cake:nocache> // view content here </cake:nocache>
it may view being cached cake not update subsequent calls.
http://book.cakephp.org/view/347/marking-non-cached-content-in-views
Comments
Post a Comment