Thank you both, I've learned something new today from each of you.

After a number of trials, I think I found the issue. There are some
newline characters in some of the rows fetched from the database. I'm
almost sure this is what is causing all the issues. I'll see if I can
handle them in the servlet itself before writing it out onto the json
stream.

As of now, I think I'll have to check each column of each row fetched
from the database, see if there are any embedded new line characters,
add the escape sequence and write to the json string that is going to
be returned. Is there a better method to handle the embedded newline
characters in the data coming from a database?

On Jul 10, 12:00 pm, "Michael Geary" <m...@mg.to> wrote:
> Instead of repeating the object name over and over again, you can simplify
> the code with an object literal:
>
>     $.ajax({
>         type: 'GET',
>         url: 'qtool',
>         processData: true,
>         data: {
>             action: 'executeQuery',
>             entity_name: queryText
>         },
>         dataType: 'json',
>         success: function(data) {
>             alert( data );
>         },
>         error: function( xhr, status, exception ) {
>             alert( xhr.responseText );
>         }
>     });
>
> If you need the object in its own variable for any reason, you can still use
> the object literal:
>
>     var params = {
>         type: 'GET',
>         url: 'qtool',
>         processData: true,
>         data: {
>             action: 'executeQuery',
>             entity_name: queryText
>         },
>         dataType: 'json',
>         success: function( data ) {
>             alert( data );
>         },
>         error: function( xhr, status, exception ) {
>             alert( xhr.responseText );
>         }
>     };
>
>     $.ajax( params );
>
> -Mike
>
>
>
> > From: MorningZ
>
> > Don't use the $.getJSON method as it, as you are finding out, has no
> > way to handle an error...
>
> > use the generic $.ajax instead
>
> > var Params = {};
> > Params.type = "GET";
> > Params.url = "qtool";
> > Params.processData = true;
> > Params.data = {action: "executeQuery", entity_name: queryText };
> > Params.dataType = "json";
> > Params.success = function(data) {
> >       alert(data);
> > };
> > Params.error = function(x,y,z) {
> >      alert(x.responseText);
> > };
> > $.ajax(Params);
>
> > that way "x" will be the error response from the server (which
> > apparently you are running into)- Hide quoted text -
>
> - Show quoted text -

Reply via email to