Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6624423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:39:06+00:00 2026-05-25T21:39:06+00:00

I for this function to load an external page. Page URL grab from DIV

  • 0

I for this function to load an external page. Page URL grab from DIV id.

$(".contentArea").load($('.contentArea').attr('id'), function(){

The page loaded, got a datatable so I added it to the callback.

$('.datatable').dataTable( {

Inside the datatable, I got an editor button, so I used the datatable callback function to call the editor without page refresh:

"fnDrawCallback": function(){

    $(".contentEditor").click(function() {

        $(".contentArea").load($('.contentEditor').attr('id'), function(){

On this stange, content editor was loaded using the same way I used to load the page containing the datatable. (Page URL passed on the button ID).

I got stuck now. On this editor, I need submit the form, I want it submitted using jquery load so the page don’t get refreshed, after the form is submitted, I want send the surfer back to the datatable page (the one that was first loaded when the page was loaded). And I will perform the action necessary to update the edited content. Any help? Thanks.

  • Im using datatable server side ajax load. That is why I used the callback.

        $(".contentArea").load($('.contentArea').attr('id'), function(){
            $('.datatable').dataTable( {
                "bJQueryUI": true,
                "sScrollX": "",
                "bSortClasses": false,
                "aaSorting": [[0,'asc']],
                "bAutoWidth": true,
                "bInfo": true,
                "sScrollY": "100%", 
                "sScrollX": "100%",
                "bScrollCollapse": true,
                "sPaginationType": "full_numbers",
                "bRetrieve": true,
                "bProcessing": true,
                "bServerSide": true,
                "sAjaxSource": $('.datatable').attr('id'),
                "fnDrawCallback": function(){
                    $(".contentEditor").click(function() {
                        $(".contentArea").load($('.contentEditor').attr('id'), function(){
                            $( "select, input:checkbox, input:radio, input:file").uniform(),
                            $( ".datepicker" ).datepicker({dateFormat: 'yy-mm-dd' }),
                            $("#validation").validationEngine(),
                            $('input[title]').tipsy(),
                            $('textarea.tinymce').tinymce({
                                 // Location of TinyMCE script
                                script_url : '../scripts/tinyeditor/tiny_mce.js',
    
                                // General options
                                theme : "advanced",
                                plugins : "table,advhr,advimage,advlink,inlinepopups,preview,media,paste,fullscreen,visualchars,xhtmlxtras",
    
                                // Theme options
                                theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,blockquote,|,forecolor,backcolor",
                                theme_advanced_buttons2 : "formatselect,fontselect,fontsizeselect,|,removeformat,|,hr,|,undo,redo,|,sub,sup,|,charmap,|,cite",
                                theme_advanced_buttons3 : "tablecontrols,|,link,unlink,anchor,|,image,preview,media,|,cleanup,code,fullscreen",
                                theme_advanced_toolbar_location : "top",
                                theme_advanced_toolbar_align : "left",
                                theme_advanced_statusbar_location : "bottom",
                                theme_advanced_resizing : true
                            });
                        });
                    });
                }});
            });  
    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:39:06+00:00Added an answer on May 25, 2026 at 9:39 pm

    To submit the form, use $.post() along with $(form).serialize(). Then, in the success handler of $.post(), use .load() again.

    $.post(url, $("#myForm").serialize(), function(data) {
        $(".contentArea").load(...);
    });
    

    Or, if the content returned from submitting the form is the html you want to display in .contentArea, you can save yourself the extra call to .load() by just using the returned html in .contentArea:

    $.post(url, $("#myForm").serialize(), function(data) {
        $(".contentArea").html(data);
    });
    

    Edit: Create functions to handle the different tasks. By the way, don’t use id to store the url. Create a custom attribute… maybe contentUrl.

    var contentArea = $(".contentArea");
    function loadContent(url, success) {
        contentArea.load(url, success);
    }
    function loadDataTable() {
        loadContent(contentArea.attr("contentUrl"), initDataTable);
    }
    function initDataTable() {
        $(".datatable").dataTable({
            ...,
            fnDrawCallback: bindContentEditor
        });
    }
    function bindContentEditor() {
        $(".contentEditor").click(contentEditorClick);
    }
    function contentEditorClick(e) {
        loadContent($(".contentEditor").attr("contentUrl"), initContentEditor);
    }
    function initContentEditor() {
        ...
        $(".submitBtn").click(postContentEditor);
    }
    function postContentEditor() {
        $.post("/postUrl", $(".contentArea form").serialize(), loadDataTable);
    }
    loadDataTable();
    

    I’ve broken it down into perhaps too many individual functions, but the point is just not to over-use anonymous functions, especially when you want to re-use functionality.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to load content from an external page (not relative) into div
I'm trying to load some external content using jQuery load function to div on
I need to load content from an external page when the user clicks on
I have to add an external page into a div, if i write this
I am trying to load an external jquery page into a div. I use
I'm loading pages asynchronously with the jQuery load function, like this: tree.click(function() { if
Why does only the third method work? $('#jqtest').live('load', function() {$(this).html('hi');}); //1 $('#jqtest').load(function() {$(this).html('hi');}); //2
I have this class that have a function to load other classes and create
After loading a PHP template (using jQuery's load function), this simple script won't make
$(document).ready(function(){ $(a[href*='http://']:not([href*='+location.hostname+'])).attr(target,_blank); $(a[target!='_blank'][target!='_top']).click(function(){ $(#actualcontent).load($(this).attr(href)); window.location.hash=$(this).attr(href); return false; }); }); So I have this code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.