How should I format a JSON POST request to my rails app?

前端 未结 2 1917
余生分开走
余生分开走 2021-01-30 03:17

My Rails app has a player class that works perfectly. Players can be created, deleted, and updated from my rails control panel without any issues.

I would like a remote

2条回答
  •  一生所求
    2021-01-30 03:56

    If you are trying this:

    via Postman - Under form-data tab, you need to have the vars as :

    player[name]
    player[room_id]
    .
    .
    

    via jQuery:

    $.ajax({ url: 'url', type: 'post', data: { player: { name: 'Test', room_id: '0' } } })
    

提交回复
热议问题