Ajax Response Does Not Perform Properly

HI,



I have tried to post this question in developers section but I am not allowed to to so, I don't know why.



I am a developer working for a cs cart client. The problem is when I post a request using ajax the request is fine but the response is just output as json on the page.



No html is rendered or updated. Can somebody tell me what am I doing wrong?



according to my knowledge it should update the ID's i mention in the request. BUt it simply outputs json on the page.



Thanks.

Okay! I have found something special after couple of hours of research on what is happening.



When the ajax request is made, the form gets submitted also which causes the page to relaod. Is there a way to stop the form from submitting if the cm-ajax is enabled and form data is being posted by ajax?



If some one can answer this I hope my problem will be solved.

cs-cart doesn't use standard ajax methods. Basically ajax in cs-cart is a re-rendering of the page on the server and then it is passed back and parsed by a whole log of JS code. It requires that comments with the div id attribute exist at the end of the div (or other tag to be replaced).



Would need to see your code specifically in order to advise. The form would always be submitted but that doesn't necessarily imply a redirect to reload the page. Generally you do something like (pseudo code):

if( $posted_data) {
manage_data($posted_data);
$view->assign('your_form_variables, $posted_data);
if( defined('AJAX_REQUEST') ) {
$view->display("your template containing code");
exit;
}
}


Have fun.

Sure!!



Here is the url of the form… Make sure you choose the 10 number of bags in each entry.



http://bit.ly/16anREU

Any help @tbirnseth??

Sorry, looking at your form isn't going to help me at all. It's about what you're doing in the template engine and what you're doing on the backend upon receipt of the form data.