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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:51:19+00:00 2026-06-14T14:51:19+00:00

I have a search results web page which breaks the results up into multiple

  • 0

I have a search results web page which breaks the results up into multiple pages. Rather then reloading the entire page as the user navigates from one search result page to the next, I’m using a jQuery ajax call to get the page (via a “GET” request), extract the element that contains the search results and then swap out the html.

This is working great, but I’m seeing a problem with my background-image CSS attribute. Some of the background image names contain spaces, so I’ve wrapped the url in quotes, like so:

<div style="position: absolute; right: 0; bottom: 0; 
            width: 30px; height: 30px; 
            background-image: url('Images/Image One_small.png');
            background-repeat: no-repeat;" 
     title="Image One">
</div>

But, when I reload the HTML element via the .html() jQuery function, it seems like HTML is reformatted (including stripping the quotes), like so:

<DIV style="BACKGROUND-IMAGE: url(Images/Icons/Image One_small.png); POSITION: absolute; WIDTH: 30px; BOTTOM: 0px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 30px; RIGHT: 0px" title="Image One"></DIV>

Chrome seems to be handling this fine, but IE8 is choking (not resolving the background image).

Does the html() function rewrite the HTML or CSS attributes? If so, is there a better solution? I don’t want to rename the images because the names are driven off user input (which can legitimately contain spaces).

Here’s my ajax call:

var l_url = "SearchResults.aspx?pg=" + pageNo;
$.ajax({
    type: "GET",
    dataType: "html",
    url: l_url,
    beforeSend: function(jqXHR, settings) {
        $("#WhiteoutDiv").css("display", "block");
    },
    success: function(data, textStatus, jqXHR) {
        $("#SearchResultsDiv").html($("#SearchResultsDiv", data).html());
        $("#WhiteoutDiv").css("display", "none");
        // The below line is for debugging. It selects one of the search result
        // elements and displays the html so I can see what's going on. Chrome's
        // developer tools give conflicting results.
        alert($(".ReportItem", data).html());
    },
    error: function(textStatus, jqXHR) {
        window.location = l_url;
    }
})

ADDENDUM

Just to be clear, everything works perfectly before the DIV is reloaded via jQuery AJAX (and was working perfectly with my old, non-jQuery AJAX implementation). The path is correct, and the CSS is valid with the quotes. Changing the space to a “+” does not fix the issue.

  • 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-06-14T14:51:20+00:00Added an answer on June 14, 2026 at 2:51 pm

    You should ALWAYS use + or %20 in place of a space in URLs:

    <div style="background-image:url(/images/image+one.png);">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application which has a search facility. On the home page
I basically have this web page where you can narrow your search results by
I have a page that displays search results and has a DOM like the
I have a script which allows to display search results on keyup: JsFiddle I
I have a script which allows to display search results. Given a query there
I have script which allows to display Bing search results. I can call for
I have a search page that if there is results in the list it
I have a asp.net MVC3 web application in which i search for a certain
If I have a page that generates search results based on some ajax components
I am trying to retrive some pages which are google search results and cached.

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.