0

I do not know if this is a node related problem or if I am missing something fundamental in my understanding here. But here is a simple JQuery line:

$('#someimgId').attr('src','/images/somefile.jpg');

someimgId is the id of an element. When the above line is executed, I would expect a HTTP request to the Node server to GET somefile.jpg so that it can be displayed. Nothing of that sort happens. In fact, the node server does not get any request.

Sunny
  • 9,245
  • 10
  • 49
  • 79
  • Can you show your express settings, just want to see if you have enabled the static resources. and if you could tell us what version of express you are using? – Jai Nov 16 '15 at 12:39

2 Answers2

1

You need to enable access to your static resources with express.static like:

app.use(express.static(path.join(__dirname, 'public')));

This express page could be a help.

Jai
  • 74,255
  • 12
  • 74
  • 103
  • I have handled all that... Of course. I am not seeing a request to the node server in the first place. Trying to understand where the problem lies... possibilities. – Sunny Nov 16 '15 at 13:56
0

The answer lies in this EXCELLENT explanation here I was changing the source of the image and after a successful return of an Ajax call was un-changing it. Chrome was, therefore, and correctly cancelling the transfer and the node server accordingly and appropriately gave the ECONNABORTED error. In short, it was a programming issue on the client side... I should be initiating the captcha generation AFTER the capcha regen image is changed and resetting it AFTER the ajax call is completed... all using appropriate callbacks - or using a library like async on the client.

The super-excellent article on Stackoverflow posted above provides additional details as well as other reasons as to why Chrome may show a request getting cancelled.

Community
  • 1
  • 1
Sunny
  • 9,245
  • 10
  • 49
  • 79