All Questions

Tagged with
Filter by
Sorted by
Tagged with
2105votes
41answers
778kviews

How do I format a Microsoft JSON date?

I'm taking my first crack at Ajax with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string ...
1717votes
59answers
1.1mviews

Convert form data to JavaScript object with jQuery

How do I convert all elements of my form to a JavaScript object? I'd like to have some way of automatically building a JavaScript object from my form, without having to loop over each element. I do ...
1229votes
11answers
912kviews

Serializing to JSON in jQuery [duplicate]

I need to serialize an object to JSON. I'm using jQuery. Is there a "standard" way to do this? My specific situation: I have an array defined as shown below: var countries = new Array(); countries[0]...
user avatar
  • 49.5k
880votes
15answers
417kviews

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 returns 200 OK, but jQuery executes the error event. I tried a lot of things, but I could not ...
user avatar
490votes
14answers
783kviews

jQuery AJAX cross domain

Here are two pages, test.php and testserver.php. test.php <script src="scripts/jq.js" type="text/javascript"></script> <script> $(function() { $.ajax({url:"testserver....
user avatar
432votes
12answers
1.4mviews

Convert array to JSON

I have an Array var cars = [2,3,..] which holds a few integers. I've added a few values to the array, but I now need to send this array to a page via jQuery's .get method. How can I convert it to a ...
user avatar
  • 38k
423votes
24answers
1.2mviews

Loading local JSON file

I'm trying to load a local JSON file but it won't work. Here is my JavaScript code (using jQuery): var json = $.getJSON("test.json"); var data = eval("(" +json.responseText + "...
user avatar
324votes
16answers
497kviews

TypeError: $.ajax(...) is not a function?

I'm creating a simple AJAX request which returns some data from a database. Here's my function below: function AJAXrequest(url, postedData, callback) { $.ajax({ type: 'POST', url: ...
user avatar
  • 8,891
308votes
9answers
430kviews

I keep getting "Uncaught SyntaxError: Unexpected token o"

I'm trying to learn some html/css/javascript, so I'm writing myself a teaching project. The idea was to have some vocabulary contained in a json file which would then be loaded into a table. I ...
user avatar
  • 3,987
306votes
14answers
65kviews

Why is it a bad practice to return generated HTML instead of JSON? Or is it?

It is quite easy to load HTML content from your custom URLs/Web services using JQuery or any other similar framework. I've used this approach many times and till now and found the performance ...
user avatar
  • 13.1k
297votes
8answers
169kviews

What is the $$hashKey added to my JSON.stringify result

I have tried looking on the Mozilla JSON stringify page of their docs as well as here on SO and Google but found no explanation. I have used JSON.stringify many time but never come across this result. ...
user avatar
  • 11.2k
259votes
5answers
583kviews

Jquery Ajax Posting JSON to webservice

I am trying to post a JSON object to a asp.net webservice. My json looks like this: var markers = { "markers": [ { "position": "128.3657142857143", "markerPosition&...
user avatar
  • 2,974
250votes
2answers
213kviews

GUI-based or Web-based JSON editor that works like property explorer [closed]

Background: This is a request for something that may not exist yet, but I've been meaning to build one for a long time. First I will ask if anyone has seen anything like it yet. Suppose you have an ...
user avatar
  • 29.3k
236votes
24answers
1.1mviews

Uncaught SyntaxError: Unexpected token with JSON.parse

what causes this error on the third line? var products = [{ "name": "Pizza", "price": "10", "quantity": "7" }, { "name": "Cerveja", "price": "12", "quantity": "5" }, { "...
user avatar
  • 6,442
222votes
3answers
710kviews

Pass array to ajax request in $.ajax() [duplicate]

I want to send an array as an Ajax request: info[0] = 'hi'; info[1] = 'hello'; $.ajax({ type: "POST", url: "index.php", success: function(msg){ $('.answer').html(msg); } }); How can I ...
user avatar
  • 9,800

15 30 50 per page
1
2 3 4 5
2459