Announcement Announcement Module
Collapse
No announcement yet.
Redirect to a page after post action Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirect to a page after post action

    Hello,

    I have a page with a list of items and another page containing a form to add a new item to this list. The form is posted to a page (POST method).

    I have files "new_item.get.XXX" which display the form
    and "new_item.post.XXX" which make the treatment and add the item to the database.

    I want to redirect the user to the list once the item has been correctly added to the database in the webscript new_item.post.js.

    new_item.post.js:
    Code:
    var connector = remote.connect("alfresco");
    [...]
    var result = connector.post(''XXXXXX");
    var repoJSON = eval('(' + result + ')');
    if (result.status.code == status.STATUS_OK){
           //REDIRECT TO THE LIST PAGE 
    }
    I found how to redirect to an error page :
    status.code = XXX;
    status.location = URL;
    status.redirect=true;

    but I can't find a way to simply redirect to another page of the application.

    Anyone has an idea ?

    Thank you

  • #2
    Hi Charlotte,

    I have a similar case and use the parameters this way:

    status.code = 302;
    status.redirect = true;
    status.location = relative_URI_to_my_page;

    and after the post it redirects to the desired page.

    Hope it helps.

    Comment

    Working...
    X