0

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

});

";
1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by d3rck
0

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".

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.