jQuery's Form plugin
Posted: Mon Mar 12, 2007 1:31 pm
I'm using jQuery's form plugin to unobtrusively convert regular forms to ajax forms. Worked well for a while, but I started working on it today, and messed something up somehow. For some reason now when it submits the form, the response text from the page the form is submitting to with ajax is being shown to the user (they are being redirected to that page) instead of being then processed by the callback function. Does anybody know why this might be happening?
Code: Select all
$("#productform").submit(function(){
var options = {
beforeSubmit: prepareData,
success: updatePage,
dataType: 'json'
};
$(this).ajaxSubmit(options);
return false;
});Code: Select all
<form id="productform" name="productform" method="post" action="http://www.example.com/php/add_product.php">
<input type="hidden" name="Action" value="ADPR">
<input type="hidden" name="Screen" value="PROD">
<input type="hidden" name="Store_Code" value="&mvte:store:code;">
<input type="hidden" name="Session_ID" value="&mvt:global:session_id;">
<input type="hidden" name="Product_Code" value="&mvte:product:code;">
<input type="hidden" name="Category_Code" value="&mvt:global:category_code;">
<div class="valign_middle">Quantity: <input type="text" name="Quantity" class="text" value="1" size="1"> <input type="image" src="images/buttons/add_to_cart.gif" alt="Add to cart" class="valign_middle" /></div>
<div id="product_attributes"><mvt:item name="product_attributes" param="product:id" /></div>
</form>
). I already talked to the hosting company, and they said they will not install any other software on their ecommerce machines. I'm getting pretty sick of my host and of miva... I really am.