Laravel AJAX PUT& DELETE

时间:2018-01-31 15:36:32

标签: ajax laravel http-delete http-put

在我的开发机器上,一切正常,关于POST,PUT,DELETE,GET。

例如:

POST https://example.com/laravel/project (will create a new project - with data coming in from ajax)
PUT https://example.com/laravel/project/1 (will update the content of project with ID 1)
DELETE https://example.com/laravel/project/1 (will delete the project with ID 1)

但是,我将项目移至生产(不同的服务器),现在

POST https://example.com/laravel/project (will create a new project as expected)
PUT https://example.com/laravel/project/1 (will not **update** project 1)
DELETE https://example.com/laravel/project/1 (will **not** delete project 1)

我已经检查了chrome的网络标签,我可以看到存在的Cookie和来自ajax调用的数据(例如,更新/修改的字段)。

此外,我的状态为200,因此我也不了解网络服务器上的任何问题。

下面我的ajax调用示例 - 它们位于$ .ajax中并具有成功和失败功能。只是显示重要的位:)

type: 'POST',
url: '/laravel/project',
data: {
    '_token': $('input[name=_token]').val(),
    'project_name': $('#project_name_add').val(),
    'category': $('#category_add').val()
}

type: 'PUT',
url: '/laravel/project/' + id,
data: {
    '_token': $('input[name=_token]').val(),
    'project_name': $('#project_name_edit').val(),
    'category': $('#category_edit').val()
},

但是,实际上并没有更新或删除任何内容。

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

尝试为其添加隐藏字段,missing = df['Open'].isnull() # get nans new_open = df['Open'].copy() # make copy # loop missing and test against a True value # if so, get the 'Last' value at index and # populate new_open value at index for i in range(missing.shape[0]): if missing[i] == True: new_open.iloc[i] = df['Last'][i-1] # replace the 'Open' values with new 'Open' values df['Open'] = new_open 该功能称为_method reference link

method spoofing