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

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -