Log in

View Full Version : Some Ajax Help



Rockonmetal
03-23-2008, 03:50 PM
Ok i've been trying to get my head around ajax... but it seems to be too overcomplicated for me... I'm trying to do a simple function like put text somewhere or execute a SQL function when a user clicks on a link... I'm confused with all the other junk...
Thanks

Nile
03-23-2008, 04:02 PM
Can we see your code? Or do you just wanna know how to do that?
I am sorta familiar with ajax. So what you would do is in the php page something like this[page.php]:


if($_GET['page'] == 'sql_f'){
$var = $_POST['text'];
mysql_query("INSERT INTO `table`(text) VALUES ($var)")or die(mysql_error());
}

And then in the ajax page you would use post data to send a the field text. With that your gonna need to send it to the page:
page.php?page=sql_f
Hope this helps.