JSON uploading stringified html

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leslie
    New Member
    • Jan 2016
    • 1

    JSON uploading stringified html

    I want to upload a whole user-updated html div, to later download again. This is what I put in the header of the html (it gave no errors, but doesn't upload either):

    Code:
    <script type="text/javascript">
     $(document).ready(function(){	 document.onbeforeunload = function {	
    content = $('#content').html();
      $.post(url, {jsonData: JSON.stringify(content) }, function(response){$('#changelist').text(response);  }); 
       }
      )};
     })
    </script>
    What am I missing? Thanks!
    Last edited by Dormilich; Jan 25 '16, 07:21 AM. Reason: please use code tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    url is not defined and the page likely is somewhere else should the AJAX response arrive.

    Comment

    Working...