Changed jquery.get to jquery.ajax to solve caching issue in documents

This commit is contained in:
Karl Cordes 2011-06-28 14:30:41 +10:00
parent b1ca8b4524
commit 05cadcf644
4 changed files with 108 additions and 114 deletions

View file

@ -61,7 +61,6 @@ $class = ' class="altrow"';?>
<?php echo $enquiry['Enquiry']['comments']; ?> <?php echo $enquiry['Enquiry']['comments']; ?>
</span> </span>
&nbsp; &nbsp;
</dd> </dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Billing Address'); ?></dt> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Billing Address'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>> <dd<?php if ($i++ % 2 == 0) echo $class;?>>

View file

@ -1,5 +1,4 @@
<?php <?php /* Quotenik 1.2 - Default Layout. Some Markup retained from CakePHP Default
/* Quotenik 1.2 - Default Layout. Some Markup retained from CakePHP Default
*/ ?> */ ?>
@ -12,15 +11,12 @@
<?php echo $title_for_layout; ?> <?php echo $title_for_layout; ?>
</title> </title>
<?php <?php
$debugLevel = Configure::read('debug'); $debugLevel = Configure::read('debug');
if ($debugLevel > 0) { if ($debugLevel > 0) {
echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon')); echo $html->meta('favicon.ico', '/img/core.png', array('type' => 'icon'));
} } else {
else {
echo $html->meta('icon'); echo $html->meta('icon');
} }
echo $html->css('quotenik'); echo $html->css('quotenik');
@ -40,8 +36,6 @@
//echo $javascript->link('ckeditor/adapters/jquery'); //echo $javascript->link('ckeditor/adapters/jquery');
echo $scripts_for_layout; echo $scripts_for_layout;
?> ?>
@ -57,8 +51,7 @@
<?php <?php
if (isset($currentuser) == FALSE) { if (isset($currentuser) == FALSE) {
echo $html->link('Login', '/users/login'); echo $html->link('Login', '/users/login');
} } else {
else {
$logoutlink = $html->link('Logout', '/users/logout'); $logoutlink = $html->link('Logout', '/users/logout');
echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')'; echo $html->link($currentuser['User']['username'], '/users/view/' . $currentuser['User']['id']) . ' (' . $logoutlink . ')';
} }
@ -139,8 +132,7 @@
<li> echo $html->link('Users Index', '/users/index'); </li> <li> echo $html->link('Users Index', '/users/index'); </li>
<li class="last"><?php echo $html->link('Add User', '/users/add'); </li> <li class="last"><?php echo $html->link('Add User', '/users/add'); </li>
</ul> </ul>
</li>*/ </li> */ ?>
?>
<li><?php echo $html->link('Search', '/enquiries/search', array('id' => 'searchLink')); ?> <li><?php echo $html->link('Search', '/enquiries/search', array('id' => 'searchLink')); ?>
</li> </li>
@ -167,10 +159,9 @@
</div> </div>
<div id="footer"> <div id="footer">
<?php echo $html->link( <?php
$html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")), echo $html->link(
'http://www.cakephp.org/', $html->image('cake.power.gif', array('alt' => __("CakePHP: the rapid development php framework", true), 'border' => "0")), 'http://www.cakephp.org/', array('target' => '_new'), null, false
array('target'=>'_new'), null, false
); );
?> ?>
</div> </div>
@ -188,7 +179,6 @@
echo "<p>Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>"; echo "<p>Search for: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>";
echo $form->input('Enquiry.search_string', array('label' => false, 'id' => 'searchString')); echo $form->input('Enquiry.search_string', array('label' => false, 'id' => 'searchString'));
?> ?>
<div class ="ui-widget"> <div class ="ui-widget">
@ -217,7 +207,6 @@
else else
echo round($mem_usage / 1048576, 2) . " megabytes"; echo round($mem_usage / 1048576, 2) . " megabytes";
echo "<br/>"; echo "<br/>";
?> ?>

View file

@ -1093,9 +1093,8 @@ span.principle-emails {
span.enquiry-view-comments { span.enquiry-view-comments {
color: #000000; color: #000000;
font-size: 100%; font-size: 90%;
text-align: left; text-align: left;
line-height: 1;
white-space: pre-line; white-space: pre-line;
} }

View file

@ -38,8 +38,10 @@ $(function() {
$.post('/line_items/ajax_add', thisLineItemInputs, function(data) { $.post('/line_items/ajax_add', thisLineItemInputs, function(data) {
if(data == 'SUCCESS') { if(data == 'SUCCESS') {
loadLineItems();
$( "#addLineItemModal" ).dialog('close'); $( "#addLineItemModal" ).dialog('close');
} }
else { else {
alert("Line Item could not be saved") alert("Line Item could not be saved")
@ -50,13 +52,10 @@ $(function() {
}, },
Cancel: function() { Cancel: function() {
loadLineItems();
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
},
close: function() {
loadLineItems();
} }
}); });
@ -410,8 +409,16 @@ function savePages() {
function loadLineItems() { function loadLineItems() {
var documentID = $("#documentID").html(); var documentID = $("#documentID").html();
$.get('/line_items/getTable/'+documentID, function(data) { /*$.get('/line_items/getTable/'+documentID, function(data) {
$("#lineItems").html(data); $("#lineItems").html(data);
});*/
$.ajax({
url: '/line_items/getTable/'+documentID,
cache: false,
success: function(data) {
$("#lineItems").html(data);
}
}); });
} }