AJAX load loses CSS - help
I have page that has normal CSS that decorates buttons on page. I reload a section of the page via AJAX, but when it is loaded I lose my CSS reference and buttons turn to hyperlinks. Here is the code (note the comment of CSS appended):
- $(function() {
- var $div = $('.req_link');
-
-
- // this had to be inserted to decorate my buttons because
- // because when the ajax reloaded the CCS was ignored
- $('.req_link').button()
- .css({
- 'text-decoration' : 'none',
- 'background' : '#2C8586',
- 'color' : 'white',
- 'width' : '95px',
- 'font-size' : '0.7em'
- }).hover(function() {
- $(this).css({
- 'background' : '#2BA6CB',
- 'color' : 'white'
- });
- }).mouseleave(function() {
- $(this).css({
- 'background' : '#2C8586',
- 'color' : 'white'
- });
- });
- // end of insert
-
-
- $(".req_link").click(function() {
- if($("#tx_types").val() == '' ) {
- alert('You must select a Treatment Type first.');
- return false;
- }
- $availability_href = $(this).attr("href");
- $('#dialog').load($availability_href+"&js=1");
- $('#dialog').dialog("open");
- return false;
- });
- $("#dialog").dialog({
- title: 'Request Appointment',
- autoOpen: false,
- draggable: false,
- position: "center top+40 window",
- width: 400,
- resizable: false,
- modal: true,
- buttons: {
- Cancel: function() {
- $(this).dialog('close');
- },
- "Request Appointment": function() {
- $(".ui-dialog-buttonpane button:contains('Request Appointment')").button("disable");
- $.ajax({
- type: 'POST',
- url: 'ajax/rad_process.php?js=1',
- data: $('#dialog form').serialize(),
- cache: false,
- error: function(xml, status, error) {
- $('#dialog').html('<p><strong>Error Code:</strong> '+status+'</p><p><strong>Explanation:</strong> '+error+'</p>');
- },
- success: function(html) {
- var duration = $("#duration").val();
- $("#dialog").dialog('close');
- /*$("#conf_msg").html(html);*/
- $("#loading").html("<img src=\"/images/ajax-loader.gif\" height=\"14\">");
- $.ajax({
- type: 'POST',
- url: 'ajax/req_appt_success.php?js=1',
- data: $('#av_list_form').serialize(),
- cache: false,
- error: function(xml, status, error) {
- $("#loading").html("");
- $('.tblha').html('<tr><td colspan=\"8\"><p><strong>Error Code:</strong> '+status+'</p><p><strong>Explanation:</strong> '+error+'</p></td></tr>');
- },
- success: function(html) {
- $("#loading").html("");
- $(".tblha").html(html);
-
- if(duration == '') {
- var msg = '<font size="3"><br>Thank you for choosing the Teal Center!<br><br>We have a 24-hour Change/Cancellation Policy: If you need to change or cancel an appointments, please do so prior to 24 hours to avoid full charge.</font><br>';
- }else{
- var msg = '<font size="3"><br>Thank you for choosing the Teal Center!<br><br>The appointment you requested is longer or shorter than our default appointment time of 60 minute. Our staff is checking to see if we can adjust the times to accommodate your request. You will receive a follow up email.</font><br>';
- }
-
- $("<div>", {html:msg,
- title: 'SUCCESS: Your Appointment Was Sent To Our Staff'
- }).dialog(
- {
- draggable: false,
- position: "center top+40 window",
- width: 500,
- height: 375,
- resizable: false,
- modal: true,
- buttons: {
- Close: function() {
- $( this ).dialog( "close" );
- }
- }
- });
- }
- });
- $("#conf_msg").show();
- $(document).scrollTop( $("#conf_msg").offset().top );
- }
- });
- return false;
- }
- }
- });
-
The style sheet include in my header is the following:
<link rel="stylesheet" href="css/TC-style.css" type="text/css" />
Any help on this would be appreciated.