tags:

views:

20

answers:

1

Whats the best way to send data to the server and have it run through a php script. Bearing in mind I do not want to have the user redirected to a different page and no response needs to be sent back from the server.

...ammended... I have the following markup.

<div id='0001' class='threadWrapper'>
<div class='littleme'>

I'm hoping to have a click event associated for the .littleme that submits as its variable the ID for its parent (in this case 0001. Something like this???

 $('.littleme').click(function{
    $.post("path/to/your/script.php", { "threadID":"//value for ID???"});
});
+1  A: 

Download jQuery Insert it into your script.

You can also just insert it via Google Hosted jQuery

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;

Insert the following javascript:

$.post("path/to/your/script.php", { "key":"value", "key2":"value2"});

Now your PHP file just looks in the $_POST super global to get the data. It is just as if a user requested the page.

Chacha102
cool, I am actually using jquery already but never find the right function I'm looking for. See my ammened post above.
kalpaitch