Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 749
  • Last Modified:

Prepend to DOM after Ajax Refresh

Hello, I am using a shopping cart that is very restrictive and I cannot edit what I need to. I am trying to add some text to a DIV using Jquery's .prepend() method, but the DIV that I need to access it not created until the 4th step of the checkout, which is refreshed in between each step.

The checkout is at https://www.lowpriceskates.com/1checkout.aspx
Feel free to add any product to the cart and go to the checkout page to see how it updates.

Here is the code that I want to add:
<script>$('#ctl00_pageContent_divEditAddress').prepend('<h1>Billing Address</h1>');</script>

Open in new window


That is supposed to add the heading "Billing Address" before the Edit link on the Payment step. Please let me know if you need any more info. Thanks!!
0
lowpriceskates
Asked:
lowpriceskates
  • 5
  • 4
1 Solution
 
mcnuteCommented:
I've gone till where credit card info is requested and didn't find the div your addressing in your code? Is this a trick to make us buy some rollers?? ;-)
0
 
Kyle HamiltonData ScientistCommented:
I see the link.

You can't do it from jquery if that part of the page is refreshed with AJAX, unless there is a callback supplied to the AJAX call. Which I'm guessing it is not. You can contact the author of the javascript does the AJAX - that's about it.

Is there not template file where you can find the spot to add the HTML?
0
 
Kyle HamiltonData ScientistCommented:
however, if it helps, you can style the link itself to be more obvious:

#ctl00_pageContent_lnkEditAddress{
font-size: 18px;
}

#ctl00_pageContent_lnkEditAddress:after{
   content: 'Billing Address';
}

That should give you a large: "Edit Billing Address" label
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
lowpriceskatesAuthor Commented:
Thanks for that CSS, kozaiwaniec. That is somewhat helpful, but does not solve my original problem. Is there no way to have Jquery code execute on each refresh of a page? For each time the page is changed or loaded the code is executed?
Thanks!
0
 
Kyle HamiltonData ScientistCommented:
you can definitly execute the code on pageload. but when the page content is updated via ajax, it is not reloaded.

to execute on page load wrap your function in the docready function.

$(function(){

//your code

});
0
 
lowpriceskatesAuthor Commented:
I've requested that this question be deleted for the following reason:

No valid answers.
0
 
Kyle HamiltonData ScientistCommented:
the answer is you cant do what you are asking for given the circumstances. that is a valid answer.
0
 
lowpriceskatesAuthor Commented:
I don't agree, I'm sure that it's possible but I'm not going to argue about it.
0
 
lowpriceskatesAuthor Commented:
Not actually a solution.
0
 
Kyle HamiltonData ScientistCommented:
like i said in a prior post, you need a callback in the ajax request.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now