Register now or log in to join your professional community.
افضل وسيلة عن طريق$(function() { $.ajax({ type : 'get', url : 'urlofmyfile.py', data : 'q='+q, dataType : 'json', success : function(availableTags){ $( "#items" ).autocomplete({ source: availableTags }); } }); });
Dear Yasamin,
When you are using AJAX to access DATABASE from HTML or JAVASCRIPT file you are going to have the rsponse as JSON or XML.
$.ajax(
url:"your path"
dataTyp: "JSON/ETC"
success:function(data){
do what ever with data
}
});
Example: If you are using PHP then you have to put function in PHP code to access database and encode the retrieved data in JSON XML or any
function retrieveData(){
/* make connection to database */
$data="SELECT * FROM XTABLE";
$result=json_encode($data);
echo $result;
/* Close connection for prformance and security reasons*/
}