Hi Razaro,
I need help on ajax request from custom page.
in view.tpl
<form action="" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="file" name="videoUpload" id="videoUpload" tabindex="7" class="videoUpload">
<input type="submit" value="Submit" id="submit_form">
</form>
in formsubmit.php file(php file in override module)
Note : file exists in root/override/modules/modulename/formsubmit.php (In original module folder its exists in same path modulename/formsubmit.php)
class formsubmitOverride extends formsubmit{
}
public function displayAjaxinsertvideo(){
$this->ajax = true;
}
in js
var url = prestashop.urls.base_url + 'formsubmit.php?fc=module&module=mymodule&controller=formsubmit';
$("#submit_form").click(function() {
//url:'formsubmit.php'
$.ajax({
url : url,
type : 'POST',
cache : false,
data : {
ajax : true,
variable_1 : 'test',
variable_2 : 'tst',
action : insertvideo,
},
success : function (result) {
alert('AJAX call was successful!'+result);
//alert('Data from the server' + response);
},
error: function() {
alert('There was some error performing the AJAX call!');
}
});
});
I tried many ways but still didn't get any solution,getting error that insertvideo not found.
please have a look and let me know the solution
Thanks