I am trying to understand how Facebook's chat feature receives messages without continuously poling the server.
Firebug shows me a single GET XmlHttpRequest continuously sitting there, waiting for a response from the server. After 5 minutes, this never timed out.
How are they preventing timeout?
An AJAX request can just sit there like...
[
{
"id":"123",
"name":"House"
},
{
"id":"1456",
"name":"Desperate Housewives"
},
{
"id":"789",
"name":"Dollhouse"
},
{
"id":"10",
"name":"Full House"
}
]
How can I render to produce this JSON format from within Ruby? I have all the data from the DB (@result) and d...
Hello,
i've got a SQL query which returns multiple rows, and i have :
$data = array(
"nom" => $row['nom'] ,
"prix" => $row['rapport'],
"average" => "$moyenne_ge"
);
which is perfect, but only if my query returns one row.
i tried that :
$data = array();
$data[$row['nom']]["nom"] = $row['nom'] ;
...
$data[$row['nom'...
Hello,
I changed the tree of my JSON-P output, and i cannot access to my object DOM anymore :
Here's my output :
jsonp1271634374310(
{"Inter-Medias":
{"name":"Inter-Medias","idGSP":"14","average":"80","services":"8.86"}
});
And here's my jQuery script :
success: function(data, textStatus, XMLHttpRequest){
widget = data.name;
w...
I am using json and jsonpickle sometimes to serialize objects to files, using the following function:
def json_serialize(obj, filename, use_jsonpickle=True):
f = open(filename, 'w')
if use_jsonpickle:
import jsonpickle
json_obj = jsonpickle.encode(obj)
f.write(json_obj)
else:
simplejson.dump(obj, f)
f.cl...
When i use the code below, im getting this error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
when returning the data, anyone can fix it? Thanks!
<?php
$mysql_server_name="localhost";
$mysql_username="";
$mysql_password="";
$mysql_database="";
$conn=mysql_connect($mysql_server_name, $mysql_...
Trying to copy a cookie from second.com to first.com, with full control of both domains.
Previously an iFrame was used, however this is not able to work across all browsers as it touched on 'third-party cookies' which are hard to implement and impossible in Safari and Chrome.
The new approach uses a SCRIPT tag pointing to second.com an...
I'm trying to create an editable grid using Asp.Net MVC 2 and Silverlight (specifically a grid that displays info from a db and allows users to update that info).
So far I've managed to put a silverlight grid on an a view, using this technique
However I have no way of getting the updated data from the silver light grid. Is there anyway...
I have an issue regarding to auto populating a select dropdown from jQuery/JSON data which is return from a ColdFusion CFC, the code is below:
$(function(){
$("#licences-add").dialog({autoOpen:false,modal:true,title:'Add Licences',height:250,width:380});
});
function openAddLicence(intInstanceID,szName,szDatasourceName){
$.getJSON('/...
Is there any jquery datepicker that consumes json data... My json data would be a list of future dates that belongs to any month should be consumed by my datepicker which should be disabled and highlighted with a color....
...
JSON is a nice way to pass complex data from my server side code to client side JavaScript. For example, in PHP I can write:
<script type="text/javascript>
var MyComplexVariable = <?= BigFancyObjectGraph.GetJSON() ?>;
DoMagic(MyComplexVariable);
</script>
This is pretty cool, but sometimes you want to pass more than basic date...
I have to make dynamic hashes, so the class example won't work since the class variables are static. I am sending in a hashmap object to toJson but it isn't working. Any suggestions on what to do?
...
Im not sure how to output MySQL data into formats below. (eg: timelist, usersex, userage from table users.)
<script type="text/javascript">
timeList = new Array(),
userSex = new Array('female','male','male'),
userAge = new Array('21','36'),
userMid = new Array('liuple','anhu');
</script>
Thanks!
...
Hello Guys,
I am unable to convert JSON string to .net object in asp.net. I am sending JSON string from client to server using hidden field (by keeping the JSON object.Tostring() in hidden field and reading the hidden field value in code behind file)
Json string/ Object:
[[{"OfferId":"1","OrderValue":"11","HostingTypeID":"3"},
{"Offe...
I have javascript object which consists of complex array of structures with nested structures of other javascript objects created dynamicaly on page etc. long story. I can't use form since my vars would be like 2_34_x_y_foo_bar_235423 due to the nature of UI.
When I send that stringified object using GET .ajax request to a remote cfc me...
I'm using following code but cannot return data from MySQL.
This is the output:
<script type="text/javascript">
var somethings= [null,null,null];
</script>
It does have three post, but I couldn't get the title(message) output.
EDIT: this is the code I'm using:
<?php
$session = mysql_connect('localhost','name','pass'); ...
I'm using following code but cannot return data from MySQL.
This is the output:
<script type="text/javascript">
var somethings= [null,null,null];
</script>
It does have three post, but I couldn't get the title(message) output.
EDIT: this is the code I'm using:
<?php
$session = mysql_connect('localhost','name','pass'); ...
Hi,
I have a JSON response that is formatted from my C# WebMethod using the JavascriptSerializer Class. I currently get the following JSON back from my query:
{"d":"[{\"Lat\":\"51.85036\",\"Long\":\"-8.48901\"},{\"Lat\":\"51.89857\",\"Long\":\"-8.47229\"}]"}
I'm having an issue with my code below that I'm hoping someone might be able...
I'm trying to mesh the below mysql query results into a single json object, but not quite sure how to do it properly.
$id = $_POST['id'];
$sql = "SELECT contracts.po_number, contracts.start_date, contracts.end_date, contracts.description, contracts.taa_required, contracts.account_overdue, jobs.id AS jobs_id, jobs.job_number, companies....
This is something I've always been curious about, is exactly why Google appends while(1); in front of their (private) JSON responses.
For example, here's a response while turning a calendar on and off in Google Calendar:
while(1);[['u',[['smsSentFlag','false'],['hideInvitations','false'],['remindOnRespondedEventsOnly','true'],['hideInv...