Skip to main content

All Questions

0 votes
1 answer
516 views

jQuery async/await Ajax call, without triggering an exception on HTTP <> 200?

I'm trying to make an async/await HTTP POST using jQuery like this: let response = await $.post({ url: 'https://example.com/product/add', data: JSON.stringify({"foo":"bar"}), ...
Magnus's user avatar
  • 18.9k
0 votes
1 answer
101 views

Get Java exception class name in javascript

I am using following code to call java web API m$.ajaxq({ url: contextPath + "/updateElapsedTime", type: "POST", data: params, contentType: "application/json; charset=utf-8", dataType: '...
Tushar Thakur's user avatar
-1 votes
1 answer
495 views

javascript alert TypeError

In the following javascript code, needSubIdCheck = $("#needSubIdCheck").text(); liveSupplierCount = $("#liveSupplierCount").text(); subIdCount = $("#subIdCount").text(); ...
Chandramohan's user avatar
0 votes
0 answers
73 views

Why isn't JavaScript throwing exceptions as the result of an asynchronous HTTP (AJAX) request?

I've written the following JavaScript function which is very simple, it takes an ID and which then is sent to a PHP page, which echoes out some JSON. It passes the ID into the PHP page via GET. For ...
carefulnow1's user avatar
1 vote
1 answer
135 views

How can I bubble an error from an $.ajax instance to the $.ajaxSetup?

I have an error callback defined in ajax setup, that will be executed in each ajax instance: $.ajaxSetup({ cache: false, error: function (data, textStatus, pStatusDescription) { if (...
Simon's user avatar
  • 4,894
1 vote
1 answer
756 views

How to handle server/connection exceptions with React and Redux thunk in a maintainable manner

I'm using Redux thunk to dispatch asynchronous actions like fetching and posting to server. Each action creator call returns a promise, which resolves when after ajax has done it's magic and Redux has ...
Tuomas Toivonen's user avatar
14 votes
3 answers
3k views

Spring MVC - RequestParamException parameter is not present

I've got an issue that occurs eventually in my website. It uses AJAX requests to get data from the server, which uses Spring MVC. What happens (intermittently) is that sometimes we got an exception ...
Gabriel R.'s user avatar
0 votes
2 answers
61 views

How to call an exception with post method (AJAX)?

If the post method is unsuccessful I want to throw an exception and write to an error log? Basically if this method returns no results I want to throw an exception and write to file. Post method: $....
dantheman's user avatar
  • 273
79 votes
6 answers
109k views

How to catch net::ERR_CONNECTION_REFUSED

Is there a way to catch failed to load resource: net::ERR_CONNECTION_REFUSED, I've tried: try { $.post('',{},function(res) { }).fail(function (xhr, textStatus, errorThrown) { xhr.textStatus ...
Kokizzu's user avatar
  • 26.9k
6 votes
1 answer
10k views

XMLHttpRequest.open() exception handling

I have the following piece of code (only relevant parts): xhttp=new XMLHttpRequest(); xhttp.open("GET",doc_name,false); xhttp.send(); xmlDoc=xhttp.responseXML; if(xmlDoc==null) { xmlDoc=loadXMLDoc(...
gopi1410's user avatar
  • 6,635
2 votes
2 answers
3k views

How to suppress this JavaScript error: Exception : TypeError: $("j2t-temp-div").down(".j2t_ajax_message") is undefined?

To reproduce this error, please kindly go to here. Select "Color" and "Size" and click "Add to Cart", when the "loading..." dialog box appears AND before it turns into the "added to cart" dialog box, ...
datasn.io's user avatar
  • 12.9k
2 votes
5 answers
442 views

Logging try{ ... } catch(e){ ... } using ajax : possible?

When I try the following in the chrome console, i get 'undefined' as the value of 'e': try{ var test=somethingInvalid(); } catch(e){ console.log(e); } How do I access the details of e? What ...
anonymous-one's user avatar
1 vote
3 answers
722 views

Javascript loaded through jQuery Ajax does not throw expected exceptions in Firebug

I have a Javascript functions which throw exceptions if something goes wrong. I have so used to this behavior, that one day it took me more than 20 minutes to find the error in code because the ...
JustAMartin's user avatar
  • 13.8k
2 votes
2 answers
1k views

How to properly generate exceptions in PHP/Dojo when returning javascript code

I am having difficulty understanding how exceptions are handled when code is fetched dynamically via AJAX and executed via eval. With clientside javascript, it is rather simple, if I have a piece of ...
puk's user avatar
  • 16.8k
2 votes
1 answer
2k views

Cant get info from FaultExceptions (javascript)

Until now I have used an webservice ASMX which I call from javascript. It has been working fine, but because I needed some control over the serialization, I am trying to switch to DataContracts and ...
user826988's user avatar

15 30 50 per page