Why it doesn't work?... Script at main file.
$('#savedocx').submit(function(){
$.ajax({
type: "POST",
url: "savedocx.php",
data: {q:'1',b:'2'},
success: function(){
alert("YESdocs");
}
});
});
And php file "savedocx.php":
<?php
if (isset($_POST['q'])){
echo "Yep!";
}
else {
echo "Error!";
}
?>
Always error=( In other files i used ajax without problem, but here....
All scripts at main php file:
$(function(){
$('#registerform').submit(function(e){
e.preventDefault();
var m_method=$(this).attr('method');
var m_action=$(this).attr('action');
var m_data=$(this).serialize();
$.ajax({
type: m_method,
url: m_action,
data: m_data,
success: function(result){
$('#tablereport').html(result);
}
});
});
$('#savexlsx').submit(function(e){
e.preventDefault();
var m_method=$(this).attr('method');
var m_action=$(this).attr('action');
var m_data=$(this).serialize();
$.ajax({
type: m_method,
url: m_action,
data: {q:'1',b:'2'},
cache:false,
success: function(){
alert("YESxlsx");
}
});
});
$('#savedocx').submit(function(){
$.ajax({
type: "POST",
url: "savedocx.php",
data: {q:'1',b:'2'},
success: function(){
alert("YESdocs");
}
});
});
});