ajax - Restful URL After Insert -


i new restful urls , have general question. let's have url use retrieve student records: somesite.com/students/123 retrieves details student id 123.

i following load empty form adding students: somesite.com/students/0 0 indicates want display empty student detail form (or somesite.com/students/new).

the question have after add student record new id. however, if add record using ajax without submitting , refreshing page, url still shows somesite.com/students/0. if user clicks refresh empty form displayed again rather new student record.

how should handled?

it's not server can't respond ajax requests, right?
need send newly generated id, , then:

  1. use window.location = 'new_url' redirect user
  2. or better, use history.pushstate() (if available) change url without redirection (and reloading) happening @ all

one thing seems off, though, use of get page/students/0 "empty record", or, understand it, "template" new records. don't think that's how restful services work, again, i'm not expert in rest services.


Comments

Popular posts from this blog

How to show in django cms breadcrumbs full path? -

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -