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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:02:07+00:00 2026-06-06T03:02:07+00:00

I have site which uses $(selector).load(path) function in more than 300 pages. Now my

  • 0

I have site which uses $(selector).load(path) function in more than 300 pages. Now my client’s requirement has changed and I need to access cross domain to call these pages.

For the purpose I have to replace all the .load( function to some cross-domain function with the help of YQL.

Is it possible to override my .load function and call prevent default and do my own code?

  • 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-06T03:02:09+00:00Added an answer on June 6, 2026 at 3:02 am

    There is no clean way to do this, especially since $.fn.load does different things depending on the arguments and replacing it would affect all those subfunctions.

    However, jQuery supports AJAX hooks which you might be able to achieve what you want.

    In case all you need is support for IE’s XDomainRequest, have a look at this plugin: https://github.com/jaubourg/ajaxHooks/blob/master/src/ajax/xdr.js


    Anyway, if you really want to replace the ajax load function of jQuery, this code should do it:

    var _load = $.fn.load;
    $.fn.load = function(url, params, callback) {
        if(typeof url !== "string") {
            return _load.apply(this, arguments);
        }
    
        // do your ajax stuff here
    }
    

    This is exactly the same check jQuery uses to decide whether someone wants to bind the onload event or perform an AJAX load.

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

Sidebar

Related Questions

I have a site which uses overlay pages, all was working fine until I
I currently have a site which uses a MySQL 4.x schema, the site uses
I have a navigation on a site which uses subnavigation in the main navigation...
I have my site mydomain.local on my local development machine, which uses a local
I have a window application which uses SP classes to create a site. I
simple question... Given I have an ASP.NET site, which uses a [custom] RoleProvider, Is
I have a site that uses a menu control tied to a sitemapdatasource which
I have a site that uses a large centered background image, which naturally loads
I have a site which uses ssl when accessing a subdomain which essentially is
I have a site which uses largeish (60-100k) background images which vary from page

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.