Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1017729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:44:56+00:00 2026-05-16T10:44:56+00:00

I’m using jqGrid to display the results of a database query. The php script

  • 0

I’m using jqGrid to display the results of a database query. The php script which performs the query and then formats the results as XML for consumption by jqGrid also does some error-checking. (For example, it might validate dates to be sure that they’re in the correct format and that the start date is before the end date.) These kinds of errors are formatted into XML, but in a different format than a successful query.

What I want to do is to intercept the result of the ajax call and process it differently depending on whether the result contains one of these custom errors. If no error is present, then I would want to load the result in jqGrid. If there is an error, I would just display on the page without the grid (since the grid is set up for a different number of columns).

What I’m looking for is the correct approach of how to proceed (not necessarily the actual code). (My issue is not how to parse the XML response, but how to intercept it so I am able to parse it.) I had hoped to use the jqGrid events like gridComplete or loadComplete, but these seem to fire after the grid is already loaded.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:44:57+00:00Added an answer on May 16, 2026 at 10:44 am

    Here’s my final solution.

    My server script returns custom errors in xml format:

     <row>
          <code>problem</code>
          <description>End date is before start date.</description>
     </row>
    

    so I used the ajaxGridOptions technique suggested by @Oleg to check for an error tag, and if found, display the error message:

     ajaxGridOptions:   
            {dataFilter:    
                function(data,dataType){    // preprocess the data
                    if ( $(data).find("code").text() == 'problem' ) {   // check for an error in the result
                        $("#list").jqGrid('GridUnload');
                        $("#errormsg").text( $(data).find("description").text() );
                    }else{
                        return data;
                    }
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.