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

  • Home
  • SEARCH
  • 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 3390644
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:42:55+00:00 2026-05-18T03:42:55+00:00

With the following jQuery.ajax response… {ysearchresponse: {responsecode:200,totalhits:0,deephits:0,count:0,start:0}} How do I do a comparison on

  • 0

With the following jQuery.ajax response…

{"ysearchresponse": 
{"responsecode":"200","totalhits":"0","deephits":"0","count":"0","start":"0"}}

How do I do a comparison on “totalhits” in order to execute the error: function() when totalhits == “0” ?

  • 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-18T03:42:56+00:00Added an answer on May 18, 2026 at 3:42 am

    You can’t. (see first comment). And trust me, you don’t want to. The error callback is meant for errors related to the ajax request and not for errors only you consider errors (i.e. nonsense data which is valid json/xml/whatever or an empty resultset).

    However, if you want your error function called, create it as a regular (named) function instead of an anonymous one and call it manually when your criteria are met. Note that making your function a regular one results in it not being a closure anymore – but without seeing your full $.ajax(...); call and some surrounding code it’s impossible to tell if that’ll be a problem or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am pulling the following response back from a page via jQuery ajax request.
Using the following JQuery/AJAX function I'm calling a partial view when an option is
I have the following jQuery $.ajax({ type: GET, url: http://f.cl.ly/items/0i1V1L1k2F440L1m2Y0G/pointdata.xml, dataType: xml, success: parseXml
I am using the following code to submit different values var evalue= 'color:#d32;font-size:12px;'; jQuery.ajax({
I have the following simple jquery snippet $(document).ready(function () { $.ajax({ url:myjson.json, dataType: 'json',
Hi I have the following code with jQuery: function reject(id) { $.ajax({ type: 'POST',
i have the following references to jquery on my page: <link href=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css rel=stylesheet type=text/css/>
I am getting Error in submitting the form using AJAX and Jquery, following is
I'm posting the following to an asp.net [Webmethod] using jquery via the $.ajax method.
My ajax (jquery) response (html) gives me a whole junk of html source code

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.