The code: (index.php
):
<head>
<?php
if(isset($_GET['text1']))
{
some_function();
}
?>
</head>
<body>
<form id="form">
<input type="text" id="text1" name="text1"/>
<input type="text" id="text2" name="text2"/>
<input type="submit" id="submit" value="submit"/>
</form>
<script>
$(document).ready(function(){
$("#submit").click(function(){
var dataString=$("form#form").serialize();
var proccessPage="<?php echo $_SERVER['PHP_SELF'] ?>";
alert(dataString);
$.ajax({
type: "POST",
url: proccessPage,
data: dataString,
});
return false;
});
});
</script>
</body>
Anyone know why some_function();
call is not triggered? I don't know if the problem is in ajax, or php, or where. I have spent two days in trying to use $.post
, or $.ajax
, searching for possible errors in code etc, but I cant find anything wrong with it.
Do you know something about it? Thanks for all answers.