Probably not very clear question ...
There is a registration form. The system validated input data (jQuery and php). When the focus (.blur) is removed from the input field, the text from the field is transferred by POST to the php script located in another folder. If you just need to count the number of characters in the name, for example, then everything is OK. And if you need to check the existence of a name in the database, you have to write all settings at the beginning of the script (mysql_connect ... mysql_select_db ...). But there are several such scripts. And there is a separate db.php file with database settings. The includ / require db.php file doesn’t want to connect. You don't want to transfer via java-script, because visible to anyone who wants to see ...
Who can what to advise?
UDP
The path may not be right. The structure is as follows:
forma.php db.php scripts/script.js php/valid.php Script.js is connected to form.php, which sends the data to valid.php. To connect db.php to valid.php you need to write require "... / db.php"?
Java: $ ("# name"). Blur (function () {var searchString = $ ("# name"). Val (); var data = 'name =' + searchString;
if(searchString) { $.ajax( { type: "POST", url: "funk/check.php", data: data, beforeSend: function(html) { $("#rName").html("<img src='imgs/iLOAD.gif' width='24px' height='24px'/>"); }, success: function(html){ $("#rName").empty(); $("#rName").show(); $("#rName").append(html); } }); } return false; });