This is a public Forum  publicRSS

Topic

    Walid Sarkis
    Comment Box Size
    Topic posted September 11, 2017 by Walid SarkisApprentice 
    54 Views, 3 Comments
    Title:
    Comment Box Size
    Content:

    Hello,

    We have a comment box in a widget, comment boxes usually have 1000+ characters, when we are trying to submit an incident via JS Ajax, we are getting an error (Screenshot SS),

    We tried to replicate the issue, we added 1000+ characters in the controller file where this webservice is trigger, there is no issue (Screenshot 1)

    we did the same thing by adding 1000+ characters to the variable in the JS file before the Ajax request, we got the error (Screenshot 2)

    this is a screenshot of the ajax request (Screenshot 3),

    please anyone know why I can't send 1000 characters in the ajax request ?

     

    Regards

    Version:
    Latest
    File:
    SS.zip (74KB)

    Answer

     

    • Ryan Peterson

      Hello Walid:

      Is this via HTTP GET? It may be that the URL is too long.

      Regards,

      Ryan Peterson

    • Narendra Muttineni

      Hello Walid,

      I have found one article related to this issue.

      There is no such limit on the string length.
      The problem is likely that you are sending the data in a GET request, so it's sent in the URL. Different browsers have different limits for the URL, where IE has the lowest limist of about 2 kB. To be safe, you should never send more data than about a kilobyte in a GET request.

      To send that much data, you have to send it in a POST request instead. The browser has no hard limit on the size of a post, but the server has a limit on how large a request can be. 

      Also, you shouldn't use += to concatenate long strings. For each iteration there is more and more data to move, so it gets slower and slower the more items you have. Put the strings in an array and concatenate all the items at once:

      Please let me know if it helps you.

      Thanks,

      Narendra 

    • Walid Sarkis
      Narendra Muttineni said:

      Hello Walid,

      I have found one article related to this issue.

      There is no such limit on the string length.
      The problem is likely that you are sending the data in a GET request, so it's sent in the URL. Different browsers have different limits for the URL, where IE has the lowest limist of about 2 kB. To be safe, you should never send more data than about a kilobyte in a GET request.

      To send that much data, you have to send it in a POST request instead. The browser has no hard limit on the size of a post, but the server has a limit on how large a request can be. 

      Also, you shouldn't use += to concatenate long strings. For each iteration there is more and more data to move, so it gets slower and slower the more items you have. Put the strings in an array and concatenate all the items at once:

      Please let me know if it helps you.

      Thanks,

      Narendra 

      View original

      Hello Narenda,

      this is my ajax request:

      RightNow.Ajax.makeRequest( this.data.attrs.buttonSubmit,
      eventObj.data, 
      {
      successHandler: this.createI,
      scope:this
      }
      );
      RightNow.Event.fire('evt_teamChanged', eventObj);

      I am guessing from your comments that this is a GET request, how to make it a POST? I am not really into the YUI used in rightnow,

      Regards

    • Narendra Muttineni

      Add type = "POST" in your Ajax request. And also please do not use += to concatenate long strings.