I have a problem.
I am using zend to create a web application and I have come across a problem with my jquery and javascripts.
I have a page showing a order with jquery code written on the page within script tags.
I'm using jquery $.post to load each page on the website.
My problem is that when you select a fresh order page (first time accessing a order page), then click on a button that opens a jquery dialog box to add information to the order the correct post variables are sent; but if you then went on to another order and clicked that add button again it sends the post variables from the previous order.
I assume the previous javascript information had been cached. If I empty my cache it works fine for the order again but fails on the order after it.
I am using php to stick the variable in question (order ID) into the inline javascript code.
I'm guessing this is my downfall.
What I don't understand is the javascript works fine for the initial loading of the page because it then goes and uses ajax to grab a few more sections of the page. That works fine but when I use my button it reverts back to the original order ID used at the beginning.
Attached is my code:
function getFreightTable()
{
$.post("order/freighttable", "OrderID=<?= $this->orderID; ?>" , function(data){
$("#tabs-3").html(data);
});
}
$("#OrderAddFreightButton").live('click',function() {
$.post("freight/new", "OrderID=<?= $this->orderID; ?>", function(data) {
$("#orderAddFreightDialog").html(data);
$("#orderAddFreightDialog").dialog({
autoOpen: true,
hide: 'slide',
show: 'slide',
title: 'Add New Freight Information',
closeOnEscape: true,
close: function(event, ui)
{
$("#orderAddFreightDialog").empty();
getFreightTable();
}
});
});
return false;
});
My php is placing the correct order id's within the code but the javascript is reverting to an older set.
I am having a similar issue with another section of the site and javascript reverting back to javascript code from 3 weeks ago even though I use it on a different computer and cleared the cache. This is freaking me out.
POSTare not cached.