?
Solved

Limit of POST method in AJAX

Posted on 2007-08-01
6
Medium Priority
?
398 Views
Last Modified: 2008-02-01
Hi ppl, I am new here and I have one problem:

I am making one application in with ajax and i want to make POST method  that is longer a lot than usual GET method with ajax because I am integrating one WYSIWYG system that would work in ajax.

And when I try to send some large text data with ajax with POST method it sends me error:

Request-URI Too Large
The requested URL's length exceeds the capacity limit for this server.

And I have asked my hosting provider (servage.net) what is the limit for post data sending and they have answered me that is 8Mb and there is the problem.

In short:
I need the code with I can send large text with POST method in AJAX.

Thank you
Ivo
0
Comment
Question by:galic1987
  • 3
  • 2
6 Comments
 
LVL 10

Accepted Solution

by:
wildzero earned 400 total points
ID: 19613489
What are you trying to do? Perhaps there is a better method to get the same result.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 600 total points
ID: 19614775
> I need the code with I can send large text with POST method in AJAX.
either increase your server limits, or you need to split your code into junks, send them to a script which joins them together.
0
 

Author Comment

by:galic1987
ID: 19615181
the problem is when I send some data with ajax with POST method and the server or browser  handle that data as GET method and sends me that error when I exceed  URL limit for different browser.

8mb is enough for my project I don't need to increase my server limit.  

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:galic1987
ID: 19615329
I have found solution:

      function ajaxprikaz(id, url) {  
      var that=this;                                                  
         var updating = false;  
                                                                              this.callback = function() {  
                                                                           //checkmeni();      
                                                                            }
         this.update = function(passData, metoda) {                                
              if (updating==true) { return false; }                        
              updating=true;                                                
              var AJAX = GetXmlHttpObject();  
             
              if (AJAX==null) {                                            
                   alert("Vaa broswer nepodr~aje ajax.");                                                            
                   return false                                                
              } else {
                   AJAX.onreadystatechange = function() {  
                        if (AJAX.readyState!=4){
                              document.getElementById("loader").innerHTML="<img  src='graphic/ajax-loader.gif' width='16' height='16'>Loading..."
                        }
                              
                              
                        if (AJAX.readyState==4 || AJAX.readyState=="complete") {
                           LayerID.innerHTML=AJAX.responseText;                  
                           delete AJAX;
                           document.getElementById("loader").innerHTML="";
                           updating=false;                                      
                           that.callback();
                                    
                        }                                                        
                   }                                                          
                   var timestamp = new Date();
                   var uri;
                  
                   if(metoda == "POST"){
                        uri ='?'+passData+'&timestamp='+(timestamp*1);  
                        AJAX.open(metoda, urlCall, true);
                        AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                        AJAX.setRequestHeader("Content-length", uri.lenght);
                        AJAX.setRequestHeader("Connection", "close");
                        AJAX.send(uri);                                            
                        return true;    
                   }else if(metoda == "GET"){
                        uri=urlCall+'?'+passData+'&timestamp='+(timestamp*1);  
                        AJAX.open(metoda, uri, true);
                        AJAX.send(null);                                            
                        return true;    
                   }
              }                                                                      
         }
         var LayerID = document.getElementById(id);                    
         var urlCall = url;                                                
}

thank you anyway :D
0
 

Author Comment

by:galic1987
ID: 19615378
one correction :
FROM:

if(metoda == "POST"){
                        uri ='?'+passData+'&timestamp='+(timestamp*1);  
                        AJAX.open(metoda, urlCall, true);

TO:

if(metoda == "POST"){
                        uri =passData+'&timestamp='+(timestamp*1);  
                        AJAX.open(metoda, urlCall, true);

now works perfect!
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 600 total points
ID: 19615448
> the problem is when I send some data with ajax with POST method and the server or browser  handle that data as GET method

hmm, if you (the browser in particular) sends using POST, then the browser "does not handle it as" GET, nor does the server
GET and POST are exclusive
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Over time, the online landscape has altered considerably, but that’s nothing compared to the up-and-coming trends that will shape the web design industry in the coming year. Keep reading to find out which trends will shape B2B web design in 2018.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question