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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:53:02+00:00 2026-05-30T20:53:02+00:00

I have a an ajax call that loads an HTML page into a div

  • 0

I have a an ajax call that loads an HTML page into a div via Ajax. Once the page is loaded into the div is it possible to manipulate the content of the HTML page that was loaded. For instance, once the page is loaded into the div I would like to style one of the images with the ID “1” to have a 1 pix border around it.

Below is the ajax code I used to load the content into the div

function getMessage(){
var sTitle = null;
var sBody = null;
var sImage = null;
sImage = GetImageID();  
 $.ajax({  
    type: "POST",  
    url: "xt_getAJAXData.asp",  
    data: {"cid":"3586",
    "elid"          :"2425",
    "sText"         : sBody,
    "title"         : sTitle,
    "img"           : sImage
   },
   success: function(resp){  
     // we have the response  
     var toLoad = 'sys_show_template.asp?step3=1&campaignid=3586'
        $('.content').fadeOut('fast', loadContent);
        $('#load').remove();
        $('#waiting').append('<div id="load">Loading<br><img src="' + loadinggif + '" alt="Loading" /></div>');

        $('#load').fadeIn('normal');
        function loadContent() {
            $('.content').load(toLoad, '', function(response, status, xhr) {
                if (status == 'error') {
                    var msg = "Sorry but there was an error: ";
                    $(".content").html(msg + xhr.status + " " + xhr.statusText);
                }            
            }).fadeIn('slow', hideLoader());
        }
        function hideLoader() {
            $('#load').fadeOut('fast');
        }
        return false;
   },  
   error: function (xmlHttpRequest, textStatus, errorThrown){  
     alert('Error: ' + xmlHttpRequest + " "+ textStatus + "" + errorThrown );  
   }  
 }); 

}

Then on page where this code is running I tried

$(‘#1’).css(‘border’, ‘solid 1px red’);

Here is the HTML. THis is for an email marketing application which is why I used tables

 <table width="99%" border="0" cellspacing="1" cellpadding="2">    
        <tr>     
            <td><img id="1" src="http://xxx.xxx.xx.xxx/upload/66/img_2873.jpg" border="0" width="180" alt="Property Picture"></td>    
            <td><img id="2" src="http://xxx.xxx.xx.xxx/upload/DD/img_2875.jpg" border="0" width="180" alt="Property Picture"></td>    
            <td><img id="3" src="http://xxx.xxx.xx.xxx/upload/77/img_2877.jpg" border="0" width="180" alt="Property Picture"></td>    
        </tr>    
      </table>

But since the id “#1” is loaded into the div as an HTML stream it does not appear to be accessible from the page that made the call.

Is is possible to manipulate the css properties of the element ID #1 loaded into page via jquery AJAX or do I have to use an iFrame?

Thanks in advance.

  • 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-30T20:53:03+00:00Added an answer on May 30, 2026 at 8:53 pm

    $(“…”).css works on responseText from $.ajax appended to a div:

    <!doctype html>
    <html>
      <head>
        <meta charset="UTF-8"/>
        <title>Example document</title>
      </head>
      <body>
        <p>Example paragraph</p>
        <script src="http://code.jquery.com/jquery-latest.js"></script>
        <script type="text/javascript">
          function reskin()
            {
            $("#betamax").html(String(arguments[0].responseText).match(/<p.*/g)[0]);
            $("#betamax p").css("color","blue");
            }
    
          function beta()
            {
            var alpha = alpha || $.ajax( {complete: reskin} );
            $("body").append(String('<div id="betamax"></div>') );
            }
          beta();
        </script>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code that performs an ajax call and loads the results into
I have an AJAX call to load a function once the page is loaded,
I have an AJAX link that currently loads a partial view into a div.
I have a web service that I call via ajax that requires the user
I have an AJAX call which loads an Dialog page, now depending upon the
I'm writing a simple AJAX call that returns a full HTML page and then
I have an $.ajax call that includes both a success and error condition: $('input[name=StateName]').live('change',
A situation I ran across this week: we have a jQuery Ajax call that
The problem is the following. We have lots of ajax call via $.ajax function.
I have a div on a page whose contents is replaced by an AJAX

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.