• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ajax Request Hangs

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


// SOMETHING TO DO


What does it do?

Eric
reply
    Bookmark Topic Watch Topic
  • New Topic