Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
|
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2007, 04:30 PM
tal tal is offline
Authorized User
 
Join Date: Apr 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Asynch parameter "true" but still synchronous!

Hi all, i REALLY need help with this
I'm using a simple AJAX call using XmlHttpRequestObject:
However, eventhough i'm setting the 'asynch' parameter of the 'open' function to 'true', the call is made synchronously!!!

I checked it by using delays in the server, and the browser hangs (all other operations that are after the call to 'send').

the code:
xmlHttpObj.open("POST",url,true);
xmlHttpObj.onreadystatechange = function() { ...}
xmlHttpObj.send(null);

and I'm using IE 7.

How can this be
Help!
Thanks!
 
Old August 19th, 2007, 02:46 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Are you running code immediately after the call to send? Try an alert in the next line combined with a long wait in the server-side code. With async as true then the alert should happen immediately, if set to false there should be a delay.

--

Joe (Microsoft MVP - XML)
 
Old August 20th, 2007, 08:25 AM
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It could be an incorrect POST request :

either

  xmlHttpObj.open("GET",url,true);
  xmlHttpObj.onreadystatechange = function() { ...}
  xmlHttpObj.send(null);

or

  xmlHttpObj.open("POST",url,true);
  xmlHttpObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlHttpObj.onreadystatechange = function() { ...}
  xmlHttpObj.send(something);

Pierre-Marie







Similar Threads
Thread Thread Starter Forum Replies Last Post
asynch vs. sync hdwriter BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 April 11th, 2007 10:22 PM
synchronous and asynchronous methods mike_remember ASP.NET 1.0 and 1.1 Professional 1 December 28th, 2006 10:52 AM
SmartNavigation="true" CraigJones ASP.NET 1.0 and 1.1 Basics 2 September 3rd, 2004 01:29 PM
2 synchronous combos in continuous forms Cr0vaX Access VBA 3 May 22nd, 2004 11:40 AM
Stupid but true Adam H-W SQL Server 2000 3 December 6th, 2003 12:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.