ajax

How to emulate XMLHttpRequest client using PHP?

I'm looking for an example how to emulate XMLHttpRequest client using PHP. In other words, send the request over HTTP POST message, and receive and process the callback message. ...

reinitialize dom events after ajax calls

Hi all, I have the following problem/doubt that I hope somebody could help me with. Let's say I have several javascript events being initialized when I load a page. In this page I allow the User to click on several action buttons (which have those events). Now, one of these buttons makes in this case an ajax call in which a successful re...

AJAX code not able to call a .php file.

I am not able to call a file: "fillDropDown.php". Why this code is not working? function MakeRequest() { var xmlHttp = getXMLHttp(); try { xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { HandleResponse(xmlHttp.responseText); } } xmlHttp.open("GET", "filldropdown.php",...

jquery + ajax + json + fill dropdown list not working

Hello, I'm pretty sure i'am almost there....but i cannot figure out how to iterate through json objects and fill a dropdown list. Here is the js code: My JSON data returned:{"name":"County1","name":"County1","name":"County1"} $(document).ready(function() { $("#ddlCountries").change(function() { ...

async execution of tasks for a web application

A web application I am developing needs to perform tasks that are too long to be executed during the http request/response cycle. Typically, the user will perform the request, the server will take this request and, among other things, run some scripts to generate data (for example, render images with povray). Of course, these tasks can ...

select_related() and many to many fields with ajax (Django)

I have a simple view that I want to respond to both ajax and regular HTTP requests. Simplified, it looks like this: def tag_search(request, tag): items = Item.objects.filter(tags__tagname__exact=tag) if request.is_ajax(): return HttpResponse(serializers.serialize('json', items), mimetype='application/json') else:...

JQuery: How to PUT JSON via Ajax?

Hi I am trying to put some JSON formatted data via Ajax with JQuery to a server. My code look like this: $.ajax({ type: "PUT", url: myurl, contentType: "application/json", data: {"data": "mydata"} }); But at server-side i receive a data=mydata string, instead of the expected JSON. Firebug tells me the same. Where is ...

jQuery callback happening too fast?

Hi, I am using ASP.NET MVC C# I have a jQuery call that deletes a Book, then in the callback I call a function that refreshes the list of Books. function rembook(id) { var agree=confirm("Deletion cannot be undone. Continue?"); if (agree) { jQuery.ajax({ url: "/Books/Delete/" + id, dataType: null, t...

How to tell if an ajax timer has gone off at page_load

Hello, I have a web application and I'm attempting to put an ajax timer control in it to give me a post back every 10-20 seconds. (possibly longer depending on performance). I have a lot of dynamically created each with auto postback. These controls are inside of their own update panel. Well, whenever an AJAX timer tick happens, I want...

Ajax Toolkit Client Rendering

Hi all, I'm working on a long, dynamic form (100 or so fields) and am using toolkit items such as CalendarBehaviors, HovermenuBehavior, etc for each field. I've never worked with that many toolkit items at once, and am seeing a big performance hit in rendering. Every instance of a toolkit control is being sent to the client in its' own...

In ASP.Net MVC, what is the best way to do an update from a dialog?

I'm trying to combine 2 parts of MVC that I haven't seen used together: 1) Ajax and 2) Error handling. The problem lies in what is returned and where (div element to update) that it's returned. I have an ASP.net MVC page that looks like the following <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Store>" %> <div id="MainPage...

wait for ajax response inside a loop

I need to wait for an ajax response inside a for loop. If I could I'd simply make a synchronous call instead of asynchronous, but I don't have that level of control: I'm using somebody else's API which in turn calls eBay's Javascript API. Below are my two functions, actually methods on the same closure/object, with categoryStack and ca...

uploading xml string

Edit: I want to know suppose if there's another way to upload the xml content without passing it as a POST parameter. is this possible? I currently have a client app that manipulates an xml file, then wants to upload its content back to the server, If I uploaded back as a get/post string in an ajax call, is there a limitation as to how...

How to retain context across an Ajax call

I need to make an Ajax call and have the response update a child of the DOM element that was clicked to trigger the event. Sample HTML: <div class="divClass"> <p class="pClass1">1</p> <p class="pClass2">Some text.</p> </div> <div class="divClass"> <p class="pClass1">2</p> <p class="pClass2">Some text.</p> </div> <div class="divC...

AJAX readystate

Hi All, This script sends a request to a Apache web server every 500ms to retrieve an XML document using AJAX. This script functioned correctly on all the browsers listed below until recently. Now the XMLHttpObject readyState will equal 4 for a minute or so but then will end up toggling between 0 and 1. When I refresh the web page, rea...

google maps v3 API mouseover with polygons?

I'm building a map using the google v3 api because it is way faster. Essentially, it's a map of an area with about 30 cities with polygons over the regions. When a user hovers over a city, I want the fillColor to get lighter, and then return to it's normal state on mouseout. when a user click, it redirects them to another page. The clic...

Problem parsing XML output (PHP/JQuery)

I scratch my head in frustration, but I can't find the answer. I'm new to Ajax and I'm trying this easy script: Here's my code: JAVASCRIPT: $(document).ready(function(){ $("#toggle_album").click(function () { $.post('backend/load_album_thumbnails.php', { text: 'my string', number: 23 }, function(xml...

Request.IsAjaxRequest returning false on POST

My question is similar to this one and I am having a similar issue, but a big difference is that I'm using the Ajax helper methods (Ajax.ActionLink and Ajax.BeginForm) instead of handling the AJAX with jQuery. Request.IsAjaxRequest() is returning true for the Edit method that accepts http GET, but false for Edit method accepting http P...

Get tinyMce mode to activate on a new textbox inserted by AJAX (in Rails)

I have a nested attribute (speeches) under a model Speaker and I'm using tinyMce to let a speaker fill out a profile form where they might have one or more speeches they give. I'm using the Rails 2.3 nested attributes helpers as used in Ryan Bates's complex-form-example github account. The tinyMce functionality is great for a "Speech" ...

Display Database Image in a Popup Dialog

Hi all, I currently have a view which contains a table looks something like this: <table> <tr> <th>Id</th> <th>Name</th> ..... <tr> <td>11233455</td> <td>Alex P Keaton</td> </tr> <tr> <td>1123455</td> <td>Jim Halpert</td> </tr> ..... </table> What I would li...