Questions tagged [xmlhttprequest]

XMLHttpRequest (XHR) is a remarkable JavaScript entity that unveils an extraordinary API, facilitating the creation of asynchronous HTTP requests directly from frontend code executed in a web browser. Hence, it plays a crucial role in unleashing the power of AJAX programming technique. Although once considered unparalleled, the XHR API has now been surpassed by the awe-inspiring Fetch API.

Permission not granted on Internet Explorer versions 10 and 11 for ajax requests targeting localhost

I have been facing an issue with making an ajax call from a server on the internet to my localhost. This works perfectly fine on browsers like Firefox and Chrome, but I am encountering problems specifically with Internet Explorer versions 11 and 10. The r ...

Transferring binary fragments to Node.js for assembly into a complete file. Creating a file

Hey there, I'm in a bit of a bind. I'm trying to send file chunks using multiple XMLHttpRequest requests and then receive these parts in Node.js to reconstruct the original file from the binary data. The issue I'm facing is that the final file is not bein ...

Using Bazel, Angular, and SocketIO Version 3 seems to be triggering an error: Uncaught TypeError - XMLHttpRequest is not recognized

Looking to integrate socket.io-client (v3) into my Angular project using Bazel for building and running. Encountering an error in the browser console with the ts_devserver: ERROR Error: Uncaught (in promise): TypeError: XMLHttpRequest is not a constructor ...

How are jQuery.ajax and XMLHttpRequest different from each other?

My goal is to fetch and run the script contained in a file named "example.js" using an AJAX request. Suppose the content of example.js looks like this: const greetings = { hello: "Hello", goodBye: "Good bye" } console.log(greetings.hello) In anot ...

Ajax received a response from http 409 and is now parsing it

Hey there! I've been working on parsing out the message object using Ajax, and I'm having a bit of trouble getting a reference to messages.msg. It's strange because it displays perfectly fine in Postman, but for some reason, I can't see ...

Tips on obtaining the ultimate URL using jQuery/AJAX

When executing $.get or .load with jQuery, the requests smoothly follow 302 redirects to provide me with the desired response. This response can be utilized in the callback function of $.get, or linked directly to the designated element for .load. Even th ...

Finding a solution for the network error encountered during the execution of XMLHttpRequest.send in the specified file path (...distfxcoreservermain.js:200

Having recently delved into Angular, I successfully completed the development of my angular web application. While using ng serve for production, everything ran smoothly. However, after incorporating angular universal and attempting npm run dev:ssr or np ...

Are XHR2 credential requests truly secure or easily faked?

I am working to determine the level of security provided by credentialed XHR2 requests. More precisely, can I verify that the request originated from a browser runtime environment, and not from a bot (such as a server-side program) that might be able to m ...

Converting the jQuery $.xajax loadmore feature into a custom XMLHttpRequest JavaScript function

I'm facing challenges while trying to create a XMLHttpRequest loadmore function as compared to using $.ajax. I am uncertain about what I might be missing in my code. Below is the function that is based on a previously working $.ajax version that I have us ...

Executing HTTP Requests for Elements in an Array using JavaScript

I am currently struggling with a script that sends HTTP requests to a website in order to obtain various documents. The document IDs are stored within an array, and my intention is to send a request for each element in the array and return a unique message ...

Trouble with Ajax program loading properly in Chrome browser

I have developed a small ajax program and encountered an issue. While it works perfectly fine on Internet Explorer 11, it does not function correctly on Chrome and Firefox. Here is the HTML file snippet: <html> <head><title>Ajax Page< ...

Angular Universal - Transfer state does not populate correctly when the URL contains unsafe characters, leading to duplicate XHR calls

Working with Angular(12) and Angular Universal has presented me with a challenge regarding the transfer state between the server and client side. On the client side, I am using the TransferHttpCacheModule, while on the server side module, I have implemente ...

What is the process for monitoring all functions that will run upon completion of an ajax request?

Let's say I am dealing with an ajax call that is initiated by a page over which I have no control. This page makes the request, processes the response, and performs its own tasks. None of this page's code belongs to me. How can I determine which function ...

What is the outcome of XmlHttpRequest.responseText?

I am new to JavaScript and looking to explore the potential of XMLHttpRequest.responseText with a specified URL. Can someone guide me on how to efficiently test this? let url = "http://m.google.com/"; <br> let xmlHttp = new XMLHttpRequest(); <br& ...

Understanding JavaScript Prototypal Inheritance within ES5 Classes

I've been working on creating an XMLHttpRequest interceptor for Angular, encountering a roadblock when trying to intercept a third-party library that uses the XMLHttpRequest API. Although the solution below is functional, I've run into issues wit ...

Identifying a failed Ajax Request in JavaScript

How can I check if an Ajax request failed to load a file? Here is the code I'm currently using: var pro = undefined; var xmlhttp; if (window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else{ xmlhttp=new ActiveXObject("Microsoft.XMLHTT ...

Is there a different option than jQuery.ajaxSettings.traditional for use with XMLHttpRequest?

Is there a different option similar to jQuery.ajaxSettings.traditional for xmlhttprequest? or What is the method to serialize query parameters for an xmlhttprequest? ...

Do not reveal result of coin flip using Javascript and API

Even though I meticulously copied my professor's parsing process, the display isn't turning out as expected. It seems like something is off in my code. <div class="main"> <p>Heads or tails? click to toss the coin</p> <p>ID ...

Alerts are essential for the proper functioning of the AJAX function. Without them

As I incorporate a substantial amount of AJAX with XML Http Requests on my website, I encounter a peculiar issue with a few random AJAX calls. There seems to be an execution problem within my JavaScript code in the onreadystatechange function where certain ...

Differentiating between HTTP requests and XML HTTP requests in Node.js with the help of express - A step-by-step

I've encountered a situation in my code where I need to differentiate between a regular HTTP request and an AJAX request (i.e XML HTTP Request). Despite my efforts, using req.isXMLHttpRequest always seems to return undefined for both types of requests. A ...

What could be causing the issue with updating a js file using ajax?

I've been dealing with a php file called users. Initially, everything was going smoothly as I wrote some JavaScript code for it. However, after making updates to the JavaScript code, it seems to have stopped functioning. Below is the content of the php fi ...

The use of credentials is not allowed when the ‘Access-Control-Allow-Origin’ CORS header is set to ‘*’

My Java web application makes CORS requests where the browser performs an OPTIONS preflight before the actual request. The format of each request is as follows: Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:63.0) Gecko/2 ...

Is it necessary for the error event of xmlhttprequest to include an error message?

Currently, I am in the process of developing an AJAX request within a Firefox extension. The following code snippet illustrates my approach: function GetMenu(){ var oReq = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); ...

Leveraging NodeJS functions within an HTML environment

After successfully creating a NodeJS back-end, I encountered a challenge. How can I connect my back-end to my front-end HTML/CSS page and utilize my NodeJS functions as scripts? ...

dojo.xhrGet not triggering callback function in Internet Explorer

My current challenge involves utilizing dojo.xhrGet to retrieve JSON data from a PHP file. Although it works seamlessly in Firefox, I have encountered compatibility issues with Internet Explorer and occasional inconsistencies with Chrome. The main proble ...

Troubleshooting Error 405 in AJAX, Javascript, Node.js (including Body-Parser and CORS), and XMLHttpRequest

I have been working on creating a JSON file from buttons. While I am able to retrieve data from the JSON files that I created, I am facing issues with posting to them using XMLHttpRequest and Ajax. Interestingly, I can add to a JSON file using routes just ...

Python Requests.get() fails to fully respond to XHR request due to an incomplete response

My current project involves scraping German zip codes (PLZ) based on a specific street in a particular city using Python's requests library. The data I am working with can be found on this server, and I'm applying techniques learned from here. The goal is ...

Transmitting various parameters with XMLHttpRequest and Windows Communication Foundation (WCF

My goal is to pass multiple parameters to a WCF service, where the server side logs incoming data. I can see errors 1 and 2 being logged, but not 3 and 4. I attempted debugging to step through the code, but the client-side javascript call isn't triggering ...

Having trouble accessing news feed with jQuery due to an unexpected token error when attempting to cross domains

I am attempting to access the Yahoo News feed from a SharePoint site, but it is causing a cross-domain access issue. Despite trying various solutions found on numerous websites and blogs, I still cannot resolve the problem. (I am executing this code in the ...

Loading remote content on a server for my Firefox OS application - On the Web and FxOS device

I haven't come across this issue in any forum, so I decided to reach out here. I'm encountering a problem with my FirefoxOS app on my FirefoxOS device (Geeksphone Developer Preview) when trying to retrieve remote content from the server. I am making AJAX ...

the event listener for xmlhttprequest on load is not functioning as expected

I am facing an issue with validating a form using JavaScript and XMLHttpRequest. The onload function is supposed to display an alert, but it only works sometimes. I'm struggling to identify my mistake. document.getElementById("button").addEventListen ...

Transform your cURL command to cURL PHP code equivalent

I am new to cURL and AJAX. I have been trying to learn on my own, but I am struggling to figure out how to convert a cURL CMD script into a cURL PHP script. Below is my cURL CMD script: curl 'https://example.url' ^ -H 'authority: example.url' ^ -H 'ac ...

Basic asynchronous JavaScript and XML (AJAX) call

I am currently learning about ajax and experimenting with a script that involves extracting information from a JSON object and displaying it on the document. Below is an example of the JSON file named companyinfo.json: { 'id':1, 'name':'Stack' } The Aja ...

Unable to retrieve JSON data from a PHP file hosted on the server

I have a server-side database with a table called "customers" and a column named "names". My goal is to send a request to the server asking for the first two records in the "customers" table. However, when I execute the program, the browser does not displa ...

Monitor responses from ajax POST requests using jQuery

Currently, I am tackling a project involving various ajax actions. The problem arises from the fact that these ajax calls are executed by scripts that I would rather not delve into. In addition, the responses they generate are erratic and lack a consisten ...

How to designate the specific container to be updated in the XMLHTTP JSON code within a Joomla website?

Below are some functions that were created by a former developer who is no longer with the company. These functions query a database and return JSON code to update the inner HTML of a specific div. I have now been tasked with setting up a typeahead search ...

Is it possible for a submission of a form to modify the content length header, resulting in the request failing?

Issue Description: After binding a submit event to an AJAX post request in order to send a predetermined key-value pair to a PHP script, the expected message indicating successful communication is not received. Despite the fact that the submit event trig ...

What is the process for sending an image via xhttp using the POST method?

I am attempting to accomplish the following: var http = new XMLHttpRequest(); var url = "saveImage.php"; var params = $('#form').serialize(); http.open("POST", url, true); http.setRequestHeader("Content-type", "multipart/form-dat ...

Guide on verifying if the request is an AJAX request using PHP

Is there a way to verify on the server-side if a request made to my PHP page is an AJAX request or not? I have come across two methods to achieve this: First method: including a GET parameter in the request to indicate that it is an AJAX request (=mypage ...

Holding onto numerous AJAX requests while disconnected, then dispatching them once the network connection is

I'm working on an application that heavily relies on AJAX requests, requiring the rapid or concurrent sending of multiple calls. The code snippet provided serves as a basic wrapper for sending AJAX POST requests within the app. However, I've enco ...

Transitioning from a traditional CURL method to utilizing AJAX and XMLHttp

I'm currently facing a challenge converting the curl code from an API named TextRazor to AJAX XMLHttp due to limitations on the platform I am working with. Despite trying various solutions shared by the community, I have been unsuccessful in retrieving any ...

Is it possible to observe cross-domain Javascript requests in Firebug or any alternative browser extension?

Is there a way to monitor cross-domain JavaScript requests made on a webpage? Is it possible with Firebug or any other plugin? Consider this scenario: If I visit stackoverflow.com and they incorporate an external JavaScript file (such as Google Analytics) ...

Button click triggering XMLHttpRequest not functioning properly due to null

I am facing an issue with my webpage. When I click on a certain section labeled as "trigger," it is supposed to print the content in the "#content" page. However, I want it to redirect back to the "home" section when I click on the "BACK" button that appea ...

Retrieve information from an HTML form

Currently, I have a piece of Javascript that fetches the HTML for a form from the server using an XMLHttpRequest and then displays the form on the page. I am looking for a solution to extract the data that would be sent via POST if the form were submitted ...

Is there a guarantee that XHR requests made within a click handler of an anchor tag will always be sent?

I'm trying to find information on whether an XHR request triggered in an anchor tag's click event handler is guaranteed to be sent. Despite my attempts at searching, I can't seem to locate a definitive answer. The specific question I have is whether it's ...

What is the method for retrieving the XMLHttpRequest errors registered with addEventListener?

I am struggling to find a solution. https://i.stack.imgur.com/bRJho.gif ...

guide for interpreting a complex json structure

I'm attempting to extract data from a JSON file that has multiple layers, like the example below. - "petOwner": { "name":"John", "age":31, "pets":[ { "animal":"dog", "name":"Fido" }, { ...

Can I send a request to an Angular server from a Node.js server?

I am currently running two servers, one with NodeJS and the other with Angular. My NodeJS server is listening on port 3000, while my Angular server is listening on port 8000. I am wondering if it is possible to access my Angular website through localhost:3 ...

"Revolutionize Your Site with Endless Scrolling using q

I am currently in the process of developing a web application using create-react-app along with the packages Infinite-Scroller and qwest. (https://www.npmjs.com/package/react-infinite-scroller) (https://www.npmjs.com/package/qwest) This is how my code l ...

Can an AJAX upload progress bar be implemented in Internet Explorer without using Flash?

I've been searching for solutions to upload files without using flash, but all of them either require flash or lack a progress bar on IE (7-8). I couldn't find any mention of an "progress" event in the MSDN documentation for XMLHTTPRequest. Is i ...

When attempting to send a GET request to the server, there is no response received, although the

I am having an issue with an ajax request I am sending to my server using jQuery's get function. The request is being sent successfully, as Firebug shows a 200 status code, but the server does not provide any response. Even when I enter the address di ...

For Firefox, the status code always comes back as 0 when using xmlhttprequest

When attempting to make asynchronous calls using the xmlhttprequest object, everything functions perfectly in Internet Explorer. However, Firefox seems to be encountering issues. Here is a snippet of the problematic code: if (req.readyState == 4) { i ...

The `XMLHttpRequest.prototype.open` function does not capture every single HTTP request visible in the chrome-dev-tools

While utilizing a third-party embedded code that initiates HTTP requests with a request header origin different from my own, I encountered an issue. Despite attempting to intercept these HTTP requests using XMLHttpRequest, they do not get intercepted. This ...

Seeking particular section of online content in an asynchronous manner

Is there a method for asynchronously requesting a specific portion of a web resource (like the initial 100 bytes) using JavaScript? I believed this could be accomplished through XmlHttpRequest by adjusting its Range header. However, if the server utilizes ...

Error code 12030: AJAX request status

When making an ajax XMLHttpRequest using the POST method, I am encountering a readyState of 4 with a status of 12030. It is known that 12030 is a Microsoft-specific state code indicating that the connection was not sustained. However, I have been unable to ...

Utilizing AngularJS and PHP to Handle Image Uploads in the Backend API

Having an issue uploading an image to my PHP web-API. I can successfully upload the image using Postman by sending a POST request with the key profilePicture and a file as the value. However, when attempting to do the same upload using AngularJS, I am cons ...

Leveraging SproutCore for Cross-Domain Service Requests

I have been struggling to find a solution to this issue. My webapp is hosted on my domain, www.myDomain.com. I need to call a service from another domain, www.anotherDomain.com/service.do. I am using SproutCore's SC.Request.getUrl(www.anotherDomain. ...

exploring the realm of creating constants in AngularJS functions

controller.js angular.module('app.main') .controller('MainCtrl', function ($scope, currentUser, addAPI) { $scope.form = {}; $scope.subdomain = currentUser.domainName; $scope.add = function () { addAPI.addAdmin(localStorage['token'], ...

One XMLHTTPRequest with multiple replies

My requirement is to have a consolidated XMLHttpRequest call that returns three unique items. These items consist of an HTML formatted table and two separate sets of JSON data for Google Charts. The reason behind this design is that the chart data relies o ...

Enabling Server-Side Control to Halt AJAX Requests in Node.js

After searching through various SO posts, I finally found a solution to make a Node.js server notify a client to stop uploading once a certain file size is reached. The approach proposed by ed-ta in their answer on Avoiding further processing on busyboy fi ...

What is the best way to upload a file in Node.js using Express and Multer?

When attempting to send a file from the front end to my node js server, I encountered an issue with receiving the file on the back end. Here is the code snippet: <form id="file-upload-form" class="uploader" action="/uploa ...

$http({method}) is malfunctioning while $http.get is functioning properly

Issue Description: While working on my project, I encountered an issue where using $http({ method : 'GET', url : data : ..... param works fine for both GET and POST requests. However, when the same method is used in JSFiddle, it blocks my reques ...

If the status is 400, Xhr does not log the response

I have implemented a basic login route in express: //login router.post('/login',async (req,res) => { try{ const user = await User.findOne({username: req.body.username}); console.log(user); if (!user) { ...

No data received from XMLHttpRequest

Within my Java Web application, I'm making an ajax request using the following code: <script type="text/javascript"> function selectTableHandler() { console.log("inside selectTableHandler"); var xhttp = new XMLHttpRequest(); var se ...

Issue detected with XMLHttpRequest - "The requested resource does not have the 'Access-Control-Allow-Origin' header."

Currently, I am working on the frontend development of an application using Angular 2. My focus is on loading an image from a third-party site via XMLHttpRequest. The code I have implemented for this task is as follows: loadFile(fileUrl) { const ...

What is the best way to send back data as a response after making a $.post request in PHP?

Looking to set up a basic post function using jQuery that takes the client's name as input and returns their information (address, phone, age, etc.). Here's what I have so far: Script: $(document).ready(function(){ $("#getClientInfo").on('click', fun ...

The Meteor application does not support XHR connections

Recently relocated an old node app (specifically Meteor) running on RedHat OpenShift PaaS to a new Linux VPS box. The issue at hand is that the node server appears to be rejecting XHR type connections from browsers directed to the port typically specified ...

Displaying or concealing an HTML element based on a JavaScript XHR request function

I have a single HTML element that I need to display and hide using jQuery within a pure JavaScript XHR request method. Currently, the element always remains visible without hiding when the request is complete or successful. On error, I would like it to be ...

Tips for maintaining ajax headers and enabling CORS in Angular resource requests

Within my ng-resource files, I have configured the ajax header as follows: var app = angular.module('custom_resource', ['ngResource']) app.config(['$httpProvider', function($httpProvider) { //enable XMLHttpRequest, indicating it is an ajax request ...

Javascript: A guide on passing an object through multiple nested functions

Hey fellow developers, I'm facing a challenge in my code and seeking advice from the experts out there. I'm attempting to retrieve JSON data from a specific URL, as shown below, and utilize it in a React component outside of the getWeather() function. How ...

Cross-origin resource sharing problem arises when JavaScript is loaded asynchronously using script tags created dynamically

By dynamically creating a script as shown below, the JavaScript source is downloaded asynchronously. let newScript = document.createElement('script'); newScript.src = srcUrl; let firstScript = document.getElementsByTagName('script')[0]; firstScript.parent ...

What is the reasoning behind Internet Explorer's decision to cache xhr requests?

There seems to be a common concern about how to address excessive caching with IE and Ajax, but there is limited information available about the reasons behind this behavior. Are there any valid scenarios where caching of ajax calls would be advantageous ...

Is it feasible to execute a cross-site request forgery attack on a URL that delivers a JSON object as a response?

I am aware of the potential for a Cross-Site Forgery Attack that can target requests returning arrays by manipulating the Array constructor. For instance, let's say I have a site with a URL: foo.com/getJson that provides the following array: ['Puff the ...

Configuring Multer destination dynamically using FormData values in Node.js

I have a scenario where I need to send a file along with some data values using an XMLHttpRequest (xhr) to a Node.js server running Express. To handle multipart data, I am utilizing Multer as bodyParser does not work in this case. router.post("/submit", f ...

What is the best way to send an Ajax Json Response to a php script?

My current setup involves an Ajax call using the xmlHttpRequest to retrieve data from a server. I aim to format this response into a specific string and share it on a different server. To achieve my goal, I am leveraging a php script for processing the fo ...