Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    May 2010
    Location
    Tampa, Florida
    Posts
    25
    Member #
    21994
    My code works the way it should in every other browser, but Google Chrome crashes my script when it tries to send.

    Code:
    function shostory(name, url, auth)
    {
    	if (window.XMLHttpRequest)
    	{
    		xmlhttp=new XMLHttpRequest(); //Modern browsers
    	}
    	else
    	{
    		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); //IE5, 6
    	}
    	xmlhttp.open("GET", url, false);
    	xmlhttp.send(null);  //Crashes right here.
    	document.getElementById("content").innerHTML = "<div id=\"story\"><h2>" + name + "</h2><p style=\"white-space:pre-wrap;\">" + xmlhttp.responseText + "</p><br /><div style=\"text-align:center; width:100%;\"><span class=\"time\">&copy; " + auth + "</span></div></div>";
    }
    Anyone know a workaround?

  2.  

  3. #2
    Junior Member
    Join Date
    May 2010
    Location
    Tampa, Florida
    Posts
    25
    Member #
    21994
    come on, now. I've been patient for three days now. No suggestions at all?

  4. #3
    Senior Member paintingtheweb's Avatar
    Join Date
    Jul 2007
    Location
    Las Vegas
    Posts
    128
    Member #
    15503
    Sorry about the delay. Have only been back on here for a few days now and just came across this. Have you tried using jQuery for you AJAX request? They've got most of the browser kinks worked out already for you. I know that the newer versions of Chrome can sometimes have some issues with scripting/rendering, but don't know enough about to tell you where the problem is.

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Pile,

    Sorry, missed this question the first time around. I've never used the XMLHttpRequest object outside the context of jQuery, so unfortunately, I can't help you.

    I think you'd be better off going that route anyway - there are just too many response and error cases to handle in AJAX calls to make it worthwhile rewriting the dozens of lines of code necessary for each call where instead you could code each call in a few efficient lines with a framework like jQuery.

  6. #5
    WDF Staff MikeB's Avatar
    Join Date
    Jun 2010
    Location
    Lincolnshire, UK
    Posts
    88
    Member #
    22274
    Quote Originally Posted by smoseley
    Sorry, missed this question the first time around. I've never used the XMLHttpRequest object outside the context of jQuery, so unfortunately, I can't help you.
    Same here! I'd say go with jquery. Here's an example jquery call I've used before:

    Code:
    function getMenuItems(menu)
    {
    	if(menu.value != null)
    	{
    		$.ajax({
    				type: "post",
    				url: "/ajax/getMenu.php",
    				cache: false,
    				data: "&menuid="+menu.value,
    				success: function(data)
    						 {
    							$("#linkparent").html(data);						
    						 }
    			});
    	}
    }
    Using that I've used to dynamically select link parents for my site menu. The variable 'menuid' has then been accessible in the getMenu.php file as $_POST['menuid'] (In php anyway)
    Mike Barlow
    WDF Co-Owner

    Need help? PM Me!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

ajax call not working in chrome

Click on a term to search for related topics.
All times are GMT -6. The time now is 10:27 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com