I'm a newbie so my apologies if this is just dumb question.
I have been struggling for 2 days using option tag as links on ajax call. I have gone through many tutorials but can't find any solution related to my work. I have OPTION list inside a SELECT tag for pagination...
The code for the SELECT tag looks like something this:
<select onchange="_change(this);">
<?php
$i = 1;
while ($lastpage >= $i):
?>
<option value="<?php echo $i?>"><?php echo $i; ?></option>
<?php
$i++;
endwhile;
?>
</select>
The above Html code is working properly and showing the page numbers according to per page record....
Possible jQuery code for the SELECT tag Function is...
function _change(id)
{
alert(id);
$.ajax({
Type: "GET",
url: "index.php?pn="+id.value,
data: id.value,
success: function (result) {
$("pre").html(result);
}
});
};
I have prompted the id to get to know about it what am actually receiving... I am able to get the id on ajax call but unable to load the data and the path remain same in the address bar..
The php code on ajax call is something like this....
if(isset($_GET['pn'])){
$id=$_GET['pn'];
echo $id." is id";
my_func();//Calling Php function
}
I am calling php function which loads the data from the database but that's not working and giving out a fata error saying Call to undefined function my_func();
Thanks in advance
related links I have search so far...