I have this script on my php file:
<script>
var lokasi="bandung";
$.ajax({
type: 'POST',
url: 'ajax_location.php',
data:{'location' : lokasi},
success: function (data) {
alert(data);
}
})
</script>
and the ajax file:
<?php
$host="localhost";
$user="root";
$password="root";
$db_name="db_urllib";
$db_connect=mysql_connect($host,$user,$password);
$db_select=mysql_select_db($db_name,$db_connect);
$query=mysql_query("insert into table values('$_REQUEST[location]')");
if($query)echo "Ok";
else echo "No";
It's working when I run it with my browser, but I want to run it with python.
Is there a way to run it with python?