Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Ajax Request Hangs

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is common function for all the ajax request in application

function ajaxRequest(actionName,dataUrl){
var htmlData=null;
$.ajax({
url: actionName,
type: "POST",
cache: false,
async:false,
data:dataUrl,
dataType:"html",
context: document.body,
success: function(data)
{
htmlData=data;
}
});
return htmlData;
}

whenever i call the ajax request my page hangs if data is more than 30kb. and i have to do some data manipulation after ajax complete.Please help
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hang?

Guessing you have a big for loop which locks up the browser.

In the future please use code tags.

Eric
 
Robert Aryan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But when i try to implement spinner it dosen't comes and give me kill pages error. Any Solution???
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First: you are making a Synchronous call with Ajax. That is bad, it locks up the browser and a spinner will never run because of that.

Second: The kill error page is probably from what ever code you are using to process the result. You do not show that, so I can not help you in that department.


You really should not be using a Synchronous Ajax Call.

Eric
 
Robert Aryan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
function getChildsManipulation(data,options)
{
var data=ajaxRequest(actionURL,{url:atitle});

// SOMETHING TO DO
}

function ajaxRequest(actionName,dataUrl){
var htmlData=null;
$.ajax({
url: actionName,
type: "POST",
cache: false,
async:false,
data:dataUrl,
dataType:"html",
context: document.body,
success: function(data)
{
htmlData=data;
}
});
return htmlData;
}
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, USE CODE TAGS Read this: https://coderanch.com/how-to/java/UseCodeTags

Eric
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


// SOMETHING TO DO


What does it do?

Eric
 
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic