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

  • Home
  • SEARCH
  • 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 8775099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:43:27+00:00 2026-06-13T18:43:27+00:00

I am loading content in using jQuery .load(), within the content that is added

  • 0

I am loading content in using jQuery .load(), within the content that is added are some data- attributes which i want to get the value from to pass into another function.

The .load() code is:

url += ' #post';    

$("#modal_base #modal_inner").load(url , function(response, status, xhr) {
    if (status == "error") {
        var msg = "Sorry but there was an error: ";
        $('#error').appendTo( '#modal_inner' );
        $("#error").html(msg + xhr.status + " " + xhr.statusText);
    }
});

The data- attributes are in #modal_base #modal_inner #post once the content is loaded in.
I presume there is no event for this element i need to somehow attach delegated event handlers to the document element.

What is the best way for me to do get the data-pag-next and data-pag-next values?

  • 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-06-13T18:43:28+00:00Added an answer on June 13, 2026 at 6:43 pm

    The complete callback will fire once the elements of the retrieved page has been loaded in the destination element and DOM updated, so you just need to look for it:

    $("#modal_base #modal_inner").load(url , function(response, status, xhr) {
        if (status == "error") {
            var msg = "Sorry but there was an error: ";
            $('#error').appendTo( '#modal_inner' );
            $("#error").html(msg + xhr.status + " " + xhr.statusText);
        } else {
            alert( $(this).find('#post').attr('data-pag-next');
            alert( $(this).find('#post').data('pag-next') ); //If using jQuery 1.4.3+
            //examples of getting the data out
            window.yourvar = $(this).find('#post').data('pag-next'); //you can access window.yourvar anywhere in your code outside .load()
            some_function_of_your( $(this).find('#post').data('pag-next') );//pass the value to some function defined by you in the global scope
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some content that I am loading using jquery ajax. The content has
i'm trying to load data into an element using jQuery.get. After loading is completed,
I want to show page loading spinner in my html page content using jquery
I am loading an XML file using jQuery $.get. after loading the content, i
I'm trying to load some external content using jQuery load function to div on
I'm loading in content using an iframe via a menu with jquery which is
I am using jQuery to load some data inside a div, after posting some
It seems that in IE9, using jquery .load will pull data from the browsers
I'm using jQuery .load() to get info out of a database. Before loading the
I am using jQuery load, to load some data from an external file like

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.