Skip to content
Advertisement

how to detect a server error into a jquery ajax call?

I use Jquery to parse an json from url: the code is like this: } everything works fine, but if the server is not reachable I’m not able to detect it: I tried to do something in error: function, but seems that the code in error is fired only if the json has an error have you got some ideas?

React Native: Align Horizontally – Center and Right

In my React Native project, I need to align two elements. One should be in the centre and the other should be extreme right of the screen. However, I’m unable to get it right. Snack URL: https://snack.expo.io/iXjlvlGpd I’m unable to get the main element in center and the next element to the right. Answer You can do something like below,

How to make a number mask using only JavaScript?

good evening. I wanna create a mask for my JavaScript project, using only Pure JavaScript, without any jQuery stuff or anything like that. What a want to do is, while I’m writing a bunch of numbers, they will be placed in certain spots. Like, for the final format, I want to do “XXX.XXX.XXX-XX”, but, while writing, “XXX.” and then “XXX.XXX.”,

How can I log the index of each array item?

I’m a beginner and struggling with this exercise. Can anyone tell me why the console is logging the index of both characters as 1. I want it to log the character ‘a’ every time it appears in the word. So for example, if we ran the function with the word ‘Saturday’ and ‘a’ as below, it should log an array

Can’t upload picture to MongoDb from React frontend

I’m creating a tinder clone, I can create a user fine however I cant upload a picture. The error I get is ValidationError: User validation failed: pictures: Cast to embedded failed for value “‘picture'” at path “pictures”. I’m not sure what I’m doing wrong. The post request seems to fire as excepted with the payload however its when I login

Moment date conversion from datepicker format problem

I have a problem with converting date time which comes from datepicker to moment (I use this library) time format. What I get from datepicker: 2021-01-30T07:00:00.000Z The code that I used via moment: Output I get with this implementation: Fri Apr 30 2021 00:00:00 GMT-0700 (Mountain Standard Time) What I expected: Fri Apr 30 2021 07:00:00 GMT-0700 (Mountain Standard Time)

Advertisement