Hi everyone,
I am having problems using $.post because of the way my website is structured. Basically, my index file handles all the pages and simply includes subpages.
I have this code for my index below:
if($pagegetter)
{
if(
!strpos($pagegetter,".")&&
!strpos($pagegetter,"/")&&
!strpos($pagegetter,"%")&&
!strpos($pagegetter,":")
)
{
if(!$sectiongetter)
$sectiongetter = "pages";
$path = $sectiongetter . "/" . $pagegetter . ".php";
if (file_exists($path))
{
include ($path);
}
else
{
$indexwarning = "Page does not exist";
}
}
else
{
$indexwarning = "This value is not allowed. :)";
}
}
else
{
echo "<br />";
}
Because of the code above, I always use
<form action='index.php?s=something&p=thephpfile'>
for posting values.
I was wondering if anyone would be kind enough to show me alternatives in posting the values in Jquery. Below is the code I am trying to make work:
echo "
$(document).ready(function(){
$('#feedback').load('users_script_registration_check.php').show();
$('#username').keyup(function(){
var username = $('#username').val();
$.post('index.php?s=users&p=users_script_registration_check', {username: username},
function(result){ if(result == 1){ $('#feedback').html(username + ' is Available'); }else{ $('#feedback').html(username + ' is not Available'); }
});
});
";