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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:33:49+00:00 2026-06-17T09:33:49+00:00

I’m looking to create a simple javascript system for making cross-domain fire-and-forget calls to

  • 0

I’m looking to create a simple javascript system for making cross-domain fire-and-forget calls to a url. Since this url doesn’t give me anything other than a status:200 when all is well, I’m trying to come up with the best solution.

The url I’m calling is out of my control, so implementing a JSONP solution or setting “Access-Control-Allow-Origin” in the header is not an option.

Also, I’ve been asked to write this without a dependency on jQuery.

One such solution I’m investigating involves creating a new script elelement with a src attribute to the url. However, since there will be many of these calls made, I also want to clean up after each call.

Here’s what I’m thinking so far:

var fireAndForgetGETRequest = function(url) {
    var head = document.getElementsByTagName("head")[0];
    var scriptTag = document.createElement("script");
    scriptTag.type = "text/javascript";
    head.appendChild(scriptTag);

    scriptTag.src = url;

    setTimeout(function() {
        head.removeChild(scriptTag);
        scriptTag = null;
    }, 5000);
};

This will clean-up the script tag after an arbitrary amount of time (in this case 5 seconds).

Would this be a reasonable solution? Would I even have to wait before cleaning-up or will the request be made instantly?

Any help from you JavaScript gurus would be greatly appreciated 🙂

  • 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-17T09:33:50+00:00Added an answer on June 17, 2026 at 9:33 am

    If you do not care about the response, why open yourself up to an XSS attack? Send the GET request via an image request.

    function sendData(url) {
        function remove() { 
            img = null; 
        }
        var img = new Image();
        img.onerror = remove;
        img.onload = remove;
        img.src = url;   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,

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.