Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将ajax函数设置为post到所需的PHP post_Php_Jquery_Ajax - Fatal编程技术网

如何将ajax函数设置为post到所需的PHP post

如何将ajax函数设置为post到所需的PHP post,php,jquery,ajax,Php,Jquery,Ajax,您好,如何将我的ajax设置为所需的PHP帖子。代码如下: $.ajax({ var feeds = $("#feeds ul"); var last_time = feeds.children().last().attr('id'); 'url' : '', 'type' : 'POST', 'data' : last_time, 'beforeSend' : function () { feeds.parent

您好,如何将我的ajax设置为所需的PHP帖子。代码如下:

$.ajax({
    var feeds = $("#feeds ul");
    var last_time = feeds.children().last().attr('id');
    'url' : '',
    'type' : 'POST',    
    'data' : last_time,     
    'beforeSend' : function () {
        feeds.parents('#feeds').find('.loading').fadeIn();
    },  
     if(isset($_POST['last_time'])){
基本上,我想将这些数据发布到下面的PHP帖子中。代码如下:

$.ajax({
    var feeds = $("#feeds ul");
    var last_time = feeds.children().last().attr('id');
    'url' : '',
    'type' : 'POST',    
    'data' : last_time,     
    'beforeSend' : function () {
        feeds.parents('#feeds').find('.loading').fadeIn();
    },  
     if(isset($_POST['last_time'])){

如何发布我的数据

您只需在url字段中添加页面名称

'url' : 'page_name.php',
如下图所示

$.ajax({
var feeds = $("#feeds ul");
var last_time = feeds.children().last().attr('id');
url : 'page_name.php',
type : 'POST',    
data : {last_time:last_time},     
beforeSend : function () {
    feeds.parents('#feeds').find('.loading').fadeIn();
},  
success: function(response)
        {  
            //when response is received do something

        }
    });
关于php

if(isset($_POST['last_time'])){
$data = $_POST['last_time']; //use this
}

在url字段中输入php页面名称!!!