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 679505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:16:01+00:00 2026-05-14T01:16:01+00:00

In the code snippet below, from my jQuery setup, I need to check if

  • 0

In the code snippet below, from my jQuery setup, I need to check if the image file actually exists and if not, I’d like to substitute a default image. Currently if the file does not exist, I just get a broken image placeholder…

$('#myTheme').change
(
    function() 
    {
    var myImage = $('#myTheme :selected').text();
    $('.selectedImage img').attr('src','../wp-content/themes/myTheme/styles/'+myImage+'/screenshot.jpg');
    //if screenshot.jpg does not exist, use "../../default.jpg" instead
    }
);
  • 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-14T01:16:02+00:00Added an answer on May 14, 2026 at 1:16 am

    It sounds like you need access to the HTTP response headers. Here’s a piece of code I found on the Internet.

    Source: http://www.vfstech.com/?cat=1

    $(document).ready(function() {
       var ajaxSubmitOptions = {
          // the normal success callback is not used
          // success: function (responseText) {
          //      ...
          // } ,
          complete: function (xhrObj, status) {   
             if(status == "error") { // 500 server error?
                alert("There was an error processing this request.");
             } else {
                if (xhrObj.getResponseHeader("X-My-Custom-Header") != "") {            
                   alert("Intercepted special HTTP header...");
                   alert(xhrObj.getResponseHeader("X-My-Custom-Header"));
                }
                else {
                   // call the function you normally would have used in the "success" callback:
                   this._success(xhrObj.responseText);
                }                  
             }
          } ,
          _success: function (responseText) {
             alert("Normal success callback...");
             alert(responseText);
          }
       };
    
       $('#myForm').ajaxForm(ajaxSubmitOptions);
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is a small snippet from a code I saw with jquery and PHP.
I am using the code snippet below, however it's not working quite as I
I need a short code snippet to get a directory listing from an HTTP
In the below code snippet, the intention is to take value for name from
I have a table defined (see code snippet below). How can I add a
In the below code snippet can i replace char * to const char *
code snippet: //byte[] myByteArray = byte array from database (database BLOB) myByteArray = (byte[])
I have written some code using jQuery to use Ajax to get data from
When using the example code from the jQuery documentation for the keypress event handler,
I have found a code snippet as given below which is used to disable

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.