0

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 Answer 1

1

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"></script>

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.