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'); }  
});

});

";

btw, I can make the code work should I move the users_form_registration.php to the www folder. But for security, I would like to ask if anyone has any ideas making the script work without having to move the file from the current folder "users".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.