0

In oscommerce I want to refresh the product div called 'left-div' with form field checked results on autosubmit- rather than whole page:- I use oscommerce 2.3.4:- Step wise I have below files- I have pulled a form on index.php in a div called 'right-div', which is called from a box module bm_form.php using below code-

    if (class_exists(bm_form)) {
$boxdata = new bm_form;
echo $boxdata->getData();
}

Now this form has below code for action on bm_form.php:-

<form name="form_srch" id="form_srch" action="'.tep_href_link(FILENAME_DEFAULT).'" method="get" >.....</form>

The form is processed at this folder

 ext/form/form.php
 ext/form/form.js
 ext/form/form.css

The above form process is called in my index.php using below code:- at very top

require('includes/application_top.php');
   require('ext/form/form.php');

The issue is I when I fill the form it triggers the entire page to refresh whereas I need to refresh only the div with form result.

My form.js uses below code for submit

 $("#form_srch").submit();  // submit form

I tried using the idea given here for ajax refresh of Div- Refreshing ajax div with form data

Editing this code in ext/form/form.js:-

 $("#form_srch").submit(
            function(e){
          e.preventDefault();
            $.get('ext/form/form.php', $(this).serialize(), function(data){
                $('#left-div').html(data);
            }
);            

           return false;
});  // submit form

And removed the action part from the form leaving action=""

But still it does not work at all the form stops working altogether, Please can someone help me get this working......

Community
  • 1
  • 1
Yuki
  • 29
  • 6

0 Answers0