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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:37:49+00:00 2026-06-11T10:37:49+00:00

I want to implement the below functionality. I have two Jquery .js files both

  • 0

I want to implement the below functionality.

I have two Jquery .js files both are imported in one HTML file and using ajax functionality. First.js has ajax function which will get the json response. If the service return success i have to call the another ajax call which is present in the Second.js

Test.Html

<!DOCTYPE html>
 <html>
   <head>
     <meta charset="ISO-8859-1">
      <title>Insert title here</title>          
      <script type="text/javascript" src='js/jquery.js'></script>
      <script type="text/javascript" src="js/test.js"></script>
      <script type="text/javascript" src="js/test1.js"></script>
   </head>
    <body>  
     <div class="ui-body">
      <fieldset class="ui-grid-a">                          
         <div id="buttondiv" class="ui-block-a"><a data-role="button" id="loginbtn" data-theme="b">Login</a></div>
         <div id="loading" style="display:none"><img src='css/images/demo_wait.gif' /></div>                                         
    </fieldset>
  </div>
</body>
</html>

First .js

  $(document).ready(function(){
     $.ajax({
           .
           .
           .            
            success:function(data){ 
                 Successcall();
            },
           error:function(xhr){ 
                  alert("Error");
            }
      });
 });

Second.js

  $(document).ready(function(){

 function Successcall(){
         $.ajax({
           .
           .
           .            
            success:function(data){ 
                 alert("In Second JS");
            },
           error:function(xhr){ 
                  alert("Error");
            }
      });
      }
 });

I am unable to call Successcall(); function from Second.js

Could some help me out on this.

  • 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-11T10:37:50+00:00Added an answer on June 11, 2026 at 10:37 am

    The Successcall function in Second.js is out of the scope of First.js, since it is enclosed within the $(document).ready() function scope.

    Muthu Kumaran’s solution would attach the Successcall function to the global object, which would work, but is quite messy IMHO.

    Perhaps this would be better (put this in Second.js)

    var my_functions = {};
    my_functions.Successcall = function() {
      // do something
    };
    

    Then call my_functions.Successcall() from First.js. This way you avoid attaching functions to the global object.

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

Sidebar

Related Questions

i want to implement next previous functionality using below function. - (void)motionEnded:(UIEventSubtype)mt withEvent:(UIEvent *)event
If I have a 5-variable function (below) and I want to implement it using
I want to implement a web page (using HTML/PHP, whatever else), that will populate
I have a website where i want to implement search functionality.So i added the
I want to implement the below: A spinner which would have a custom layout,
Below is my code for setting up a listview. I want to implement a
I wanted to implement a Node type like written below but I want to
Shell example is below. Basically, I want a client and employee to implement the
i starter in jqgrid, i want implement inline edit in jqgrid i have this
I want implement paging same as safari in iphone.When user touch below button of

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.