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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:02:49+00:00 2026-06-16T14:02:49+00:00

Maybe that’s not a good question but I’m wondering if it would be somehow

  • 0

Maybe that’s not a good question but I’m wondering if it would be somehow easily and quickly (with just 1 function perhaps?) possible to change ALL links on website from refreshing webpage to loading the URL that user clicked via AJAX?

My website has standard links everywhere but if you want to have mobile application for iPhone out of it you need to use AJAX everywhere (and perhaps HTML5 History API) because any link will open Safari browser.

Do you think there’s any way to quickly convert every single link to delete current source code and load brand-new page without refreshing browser window? Or does it require manual coding and separate functions for every single set of links?

Example:

jQuery(document).on('a', 'click', function(){
// STEP1: AJAX call that will make PHP download page from link
// STEP2: Delete current source code and load new one (in this case including deletion of this function itself)
});

Do you think it would be possible or are there any pitfalls here?

  • 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-16T14:02:50+00:00Added an answer on June 16, 2026 at 2:02 pm

    I’ve done something similar to this. It’s possible, but you may have to change a couple of things on server side.
    In my case, i had some links with href = #, some of them had click triggers, so i wanted to keep them out.

    In this function i check every link without href = #, and if they don’t have a click event, i bind ajax.

    bindAjaxLinks: function() {
       $('a[href!="#"]').each(function() {
                var eventObj = $(this).data('events');
                if (!eventObj || !eventObj.click) {
                    // not a javascript link, do your thing
                    var link = $(this).attr('href');
                    if (link) {
                        $(this).click(function(event) {
                            event.preventDefault();
                            // do your ajax calling here.
                        });
                    }
                }
        });
    

    Some considerations: In my case, i added an extra parameter, something like isAjax to every request i made with this function, and in backend i sent only a part of whole page(without head and some other markup). And later i replaced what is visible to user with this new html.

    This caused a problem: if server responded with a redirect, i got the whole page, which i didn’t want, so i made sure this isAjax parameter is kept after redirects, and that solved this problem.

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

Sidebar

Related Questions

I realised this might be relatively niche, but maybe that's why this is good
Maybe that's a somewhat uncommon question but here we go. Here's the code $userName=(Google);
Maybe that's a stupid question, but i'm totally unsure about how intelligent a view
Maybe that's a noob question but is there a way to have an yellow
Maybe that's not exactly the solution i need, but this is what i want
Maybe that's a silly question... But what's the best (performance and memory wise) way
Does anyone know if Python's shelve module uses memory-mapped IO? Maybe that question is
If have an element that maybe disabled on a page, and would like to
I have to develop an appliction (Asp.Net - maybe MVC) that would be integrated
Maybe that's silly, but I'm confused again when trying to find appropriate names for

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.