Hi,
Im trying to run a MYSQL query to check if the input value exists first.
A user fills in an input field and clicks "Add Tag"
The java script on the same page checks the MYSQL table if that tag is already there and if so returns a faded in DIV to say it already exists otherwise it INSERTS the value into the table and fades in a DIV saying "Tag Added to Database"
Please see my code below, it currently runs an external php file that does it for me using just php and the mysq; query.
Except i cant seem to work out how to run it inside my page so that it fades in the DIV.
<script type="text/javascript">
$('#i1').hide(); // this is my div that says tag inserted!
$('#i2').hide(); // this is my div that says tag already exists
$("#keyword").click(function() {
var txt = $.ajax({
url: 'process.php',
async: true,
type:'POST',
data:({
tag:$('input#newtag').val(),
})
}).success;
// This is where i need to add the database connect check if value exists.
// The url: 'process.php' does work for me but it dosent return my div responses because its and external file.
});
</script>
Thank you in advance :-)