json

parse google maps geocode json response to object using Json.Net

I have a DB full of addresses I need to get lat and long for, so I want to loop through them and use Google Geocode to update my database. I am stuck as to how to parse the JSOn result to get what I need: var address = "http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"; ...

Getting Database Data to the client side.

I'm sure this has been asked a million times, but what is the accepted approach to this? I have been writing php code for a while and up until recently I only copied+pasted javascript code, but now with help from YUI I've begun to understand javascript and want to use it more in an existing web app I have. I want to get various amounts...

What do browsers want for the Content-Type header on json ajax responses?

I am returning some json which needs to be handled by javascript as the response to an XMLHTTPRequest. If I set the response's content type to "text/plain", all browsers but Chrome will accept it and pass it to my JS with no problem. However, Chrome will wrap the response in <pre style="word-wrap: break-word; white-space: pre-wrap;"> ...

Problem with truncation of floating point values in DBSlayer.

When I run a query through DBslayer http://code.nytimes.com/projects/dbslayer the floating point results are truncated to a total of six digits (plus decimal point and negative sign when needed). { ... "lat":52.2228,"lng":-2.19906, ... } When I run the same query in MySQL, the results are as expected. | 52.22280884 | -2.19906425 ...

GWT-EXT tree xml Error

i am new to GWT GWT-EXT and i mimic it's demo the problem is where i should put xml file final TreePanel treePanel = new TreePanel() { { setAnimate(true); setEnableDD(true); setContainerScroll(true); setRootVisible(true); } }; final XMLTreeLoader loader = new XMLTreeL...

jquery json parsing

How do I parse this json with jQuery? DayEvents : [{"0":"886","event_id":"886","1":"5029","user_id":"5029","2":"Professional","user_type":"Professional", ... ...

Issue using JSON with JQuery and MVC

I'm trying to execute my controller from javascript using jquery... here is my jquery code that is executing.. <script type="text/javascript"> $('form').submit(function (e) { e.preventDefault(); $.ajax({ type: "POST", url: $(this).attr("action"), data: $(this).serialize(), contentType: "application/json;charset=utf-8", ...

How to create and send JSON from client side

Hello, I have a web application. On the client side I basically need to get the values of some fields and turn them into JSON and then send them to the server in an AJAX kind of way.(asynchronous) How would you do that? I also am using jQuery ...

IE AJAX/Jquery issue - redirecting to new page instead of loading it into a div

I have a page like this: <form class="ajax" method="post" action="add_item.php"> [text input] [submit button] </form> [list any items the user has in a div here called #items] When the user clicks the submit button, a function like this is called: $("form.ajax").live('submit', function(event) { params = $(this).serialize(); $.post...

Asp.Net MVC 2: Any way to share data contracts with client side javascript?

If you have the following: Asp.Net MVC 2 project having object classes that define view models. Serialize these models to the web browser client using JSON. Client adds information to the objects, like an Order Line on an Invoice. Client sends back the object to the server for processing. Is there any way to share with the client a d...

Unsafe JavaScript attempt to access frame, when try to upload file with ajax

Hello. My goal is to upload file with ajax-way. I use this javascript library http://valums.com/wp-content/uploads/ajax-upload/demo-jquery.htm There is a link on my page like "Upload" button on example page. When I click it, "Open file" dialog is open. I choose file and form is automatically submitted. This is my javascript code. v...

controlling joopz, probably jquery or php

there's a site: http://joopz.com you can use a browser to send a receive text messages do you think it is possible for me to programmatically control and gather data from the browser? this would mean i can make a database of incoming text messages to the browser and i could also programmatically send text messages from the browser>? ...

Define "cyclic data structures"

At the JSON site it says JSON does not support cyclic data structures, so be careful to not give cyclical structures to the JSON stringifier. What does it mean by this? Can someone give me an example of such a data structure in Javascript? ...

In Django : How to serialize dict object to json ?

I have this very basic problem, >>> serializers.serialize("json", {'a':1}) Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/lib/pymodules/python2.6/django/core/serializers/__init__.py", line 87, in serialize s.serialize(queryset, **options) File "/usr/lib/pymodules/python2.6/django/core/seria...

jQuery DataTables: Problems with POST Server Side JSON output

Hello Everyone, I am trying to get my datatable to take a POST JSON output from my server. This is my client side code: <script> $(document).ready(function() { $('#example').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "http://localhost/staff/jobs/my_jobs", "fnServerData": f...

jquery json null when using localhost

I am trying to load json generated by my django app. It works when I save the json output and load it from a static file. However, when I make a call to a server it returns null. JSON {"users": [ { "id": 1, "name": "arnold" }, { "id": 2, "name": "frankie" } ]} Ajax call $.ajax({ u...

where do I put the respond_to if there is an if-statement in the controller in rails?

I have a controller that has if-condition: def update @contact_email = ContactEmail.find(params[:id]) if @contact_email.update_attributes(params[:contact_email]) flash[:notice] = "Successfully updated contact email." redirect_to @contact_email else render :action => 'edit' end end Where do I put ...

How to convert a JSON string to an object?

How can I convert a JSON string to an object in JavaScript? Is there a method that does this? Something like: var x = "{ id: 5, name: 'hello' }"; var y = /*something*/(x); alert(y.id + " " + y.name); ...

Accettend letter and other graphic simbols PHP->JS

I have to read a txt via file php. This file contains some normal so may contains this kind of symbols : € é ò à ° % etc I read the content in php with file_get_contents and transform these for inserenting in SQL database. $contFile = file_get_contents($pathFile); $testoCommento = htmlspecialchars($contFile,ENT_QUOTES); $...

Remote Ajax Call in jQuery .click() function doesn't finish before going to next page.

I need to send click information on my website to a third party server using ajax (json). I am using jquery and I added the click event to certain links. In the click event I am making a json request to a remote server with the location of the click (heat map) and some other information. The problem is that the ajax function doesn't fir...