Tag: javascript

63 votes
16 answers
1.9K views
Ajax request returns 200 OK, but an error event is fired instead of success

I have implemented an Ajax request on my website, and I am calling the endpoint from a webpage. It always retu

avatar
Venice
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
349 views
Scroll to bottom of div?

I am creating a chat using Ajax requests and I'm trying to get messages div to scroll to the bottom witho

avatar
Fabian
0 1 0 9
asked 07 September, 2021
59 votes
20 answers
2K views
jQuery AJAX submit form

I have a form with name orderproductForm and an undefined number of inputs. I want to do some kind of jQuery.

avatar
Keith
0 1 0 9
asked 07 September, 2021
56 votes
25 answers
1.8K views
Is Safari on iOS 6 caching $.ajax results?

Since the upgrade to iOS 6, we are seeing Safari's web view take the liberty of caching $.ajax calls. Thi

avatar
Luis
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
777 views
Disable same origin policy in Chrome

Is there any way to disable the Same-origin policy on Google's Chrome browser?

avatar
Thurman
0 1 0 9
asked 07 September, 2021
58 votes
17 answers
369 views
JavaScript hashmap equivalent

As made clear in update 3 on this answer, this notation: var hash = {}; hash[X] does not actually hash the ob

avatar
Tana
0 1 0 9
asked 07 September, 2021
65 votes
5 answers
1.7K views
59 votes
30 answers
1.5K views
Simplest code for array intersection in javascript

What's the simplest, library-free code for implementing array intersections in javascript? I want to writ

avatar
Clarice
0 1 0 9
asked 07 September, 2021
53 votes
27 answers
1.2K views
How do you implement a Stack and a Queue in JavaScript?

What is the best way to implement a Stack and a Queue in JavaScript? I'm looking to do the shunting-yard

avatar
Tuan
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
415 views
Can I hide the HTML5 number input’s spin box?

Is there a consistent way across browsers to hide the new spin boxes that some browsers (such as Chrome) rende

avatar
Tana
0 1 0 9
asked 07 September, 2021
55 votes
12 answers
771 views
Why don't self-closing script elements work?

What is the reason browsers do not correctly recognize: <script src="foobar.js" /> <!-- self-closing

avatar
Xavier
0 1 0 9
asked 07 September, 2021
51 votes
29 answers
2.2K views
Retrieve the position (X,Y) of an HTML element relative to the browser window

I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
1.5K views
How do I modify the URL without reloading the page?

Is there a way I can modify the URL of the current page without reloading the page? I would like to access th

avatar
Sydney
0 1 0 9
asked 07 September, 2021
56 votes
23 answers
2K views
Storing Objects in HTML5 localStorage

I'd like to store a JavaScript object in HTML5 localStorage, but my object is apparently being converted

avatar
Santiago
0 1 0 9
asked 07 September, 2021
66 votes
11 answers
968 views
how to get the base url in javascript

I am building a website with CodeIgniter, I have various resources that I load with the base_url helper functi

avatar
Hildegard
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
2.7K views
jQuery Get Selected Option From Dropdown

Usually I use $("#id").val() to return the value of the selected option, but this time it doesn't work. T

avatar
Suzan
0 1 0 9
asked 07 September, 2021
58 votes
22 answers
1.2K views
jQuery get specific option tag text

All right, say I have this: <select id='list'> <option value='1'>Option A

avatar
Elicia
0 1 0 9
asked 07 September, 2021
54 votes
14 answers
1.1K views
How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?

I have a JavaScript widget which provides standard extension points. One of them is the beforecreate function.

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
2.4K views
How to check if element is visible after scrolling?

I'm loading elements via AJAX. Some of them are only visible if you scroll down the page. Is there any wa

avatar
Alphonso
0 1 0 9
asked 07 September, 2021
57 votes
16 answers
1.1K views
How do I set/unset a cookie with jQuery?

How do I set and unset a cookie using jQuery, for example create a cookie named test and set the value to 1?

avatar
Omar
0 1 0 9
asked 07 September, 2021