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 8774043
In Process

The Archive Base Latest Questions

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

I know it’s not possible to call an jQuery Plugin within an .ajax() loaded

  • 0

I know it’s not possible to call an jQuery Plugin within an .ajax() loaded page, the only way is to write a function in the parent page and call this function in the function(data) part of the AJAX request. This works in general, but I’m stuck because my function needs a variable from the loaded content to work correctly and whatever I’m trying, I can’t get the variable from the loaded content into the parent function, see my example:

This is my function:

function doPaginate(maxpage) {
    jQuery("#demo5").paginate({
        count: maxpage
    });
}​

This is my jQuery.ajax() request:

function loadProfileTab(tab, ownerinfo) {
    jQuery.post("./profile_ajax.php", {
        task: 'profiletab',
        v: tab,
        user_id: ownerinfo
    }, function(data) {
        jQuery("#profile_content_wrapper").html(data);
        doPaginate(maxpage);
    });
}​

What I’m trying is now to get the variable maxpage from the PHP loaded content into the function doPaginate(maxpage) within the AJAX request.

I know some workarounds, in example start a request first to get the result of $maxpage, then start a request again to use this result in the new request, but it seems to be not the “nicest” solution.

Can someone lead me to a better solution please? Or is it just impossible what I’m trying in my code example above?

Best regards!

  • 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:27:42+00:00Added an answer on June 13, 2026 at 6:27 pm

    You could add the value for the maxpage variable as a hidden field in the HTML returned by AJAX and use jQuery to find the value, something like this.

    var data = '<html><head></head><body><form><div>Ble</div><input id="maxpage" type="hidden" value="10"/></form></body></html>';
    var maxpage = $(data).find('#maxpage').val();
    console.log(maxpage);
    alert(maxpage);
    

    Here’s the DEMO for this code.
    ​

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

Sidebar

Related Questions

Know if it's possible to access the iPhone compass in Safari using JavaScript? I
I know you can not set a key value dynamically, but what about the
I know that Phonegap has an event for back button, but it's only available
I KNOW I did this in WP7 (not WP7.1) and I can't figure out
Know of a way to mock %[]? I'm writing tests for code that makes
I know the title is not great but I think the code will come
I know that setting the style properties causes browser reflows . Is it possible
I know its probably possible, but is it practical and doable to try and
I know its probably possible, but is it practical and doable to try and
Anyone know if it's possible to databind the ScaleX and ScaleY of a render

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.