开发者

sending data to a php script

开发者 https://www.devze.com 2022-12-24 04:24 出处:网络
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

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 开发者_C百科for ID???"});
});


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号