Get POST parameter from url

73 views
Skip to first unread message

Zlatko Josic

unread,
Sep 10, 2014, 6:43:40 PM9/10/14
to ang...@googlegroups.com
Hi,

Is it possible to get POST parameters in angular application from URL. I have two applications A and B where B is an angular application.
A application does redirection to B application with POST parameters. Is it possible to extract those parameters in B application?

Thanks

Zlaja

Sander Elias

unread,
Sep 11, 2014, 4:04:04 AM9/11/14
to ang...@googlegroups.com

Hi Zlatko,

Yes it is possible, There are several way's to achieve this. 


Regards
Sander

Raul Vieira

unread,
Sep 11, 2014, 7:53:01 AM9/11/14
to ang...@googlegroups.com
The way I understood the ask was A makes a POST request to A which responds with a redirect to B.  If that's the case B can get at the posted params if they are included in URL.  ie, params in the body are included in the redirect URL.

Did I understand correctly?

Raul

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Zlatko Josic

unread,
Sep 11, 2014, 7:59:12 AM9/11/14
to ang...@googlegroups.com
Application A sends request to application B. Application A is server type of application and B is angular js application.


Zlaja

Sander Elias

unread,
Sep 11, 2014, 8:55:16 AM9/11/14
to ang...@googlegroups.com
Hi Zlatko,

Hi, I did misread your question indeed! However, you still can use $locate to read out the URL.
But as your angular app is running in the browser, you can't use it to act as a server.
So you can't make your server do a get/put/post/* to a client.
That being said. If you use web-sockets, or long-polling or another server-push/pull technique
you can do what you want. 

Of coarse its much simpler that if your app detects an URL change to  just do an $http.*('to_server') with the new parameters.

Regards
Sander

Zlatko Josic

unread,
Sep 11, 2014, 9:18:48 AM9/11/14
to ang...@googlegroups.com

Sorry, I have made mistake in the last explanation. Application A would be system of UI and server application. Also, application B would be system
of UI and server application. This is a scenario how it works:

1. User load UI of A app enter transaction id and click submit
2. Sumbit handler calls web service on A application server (with transaction id as data) which in turn calls web service of B application server
3. Now, we have transaction id in B application server and user is still on UI of A app
4. Now, UI of A app redirect user to UI of B application to identify himself on B system and finish processing. Transaction id (created from UI of A app) is important for that processing

Step 4 is important. I would like to send transaction id from UI of A app, as POST parameter, when redirecting user so that UI of B app can extract that parameter.
So, my question is, can angular js app (app B in this case) extract that POST parameter.

Thanks

Zlaja

Sander Elias

unread,
Sep 11, 2014, 12:08:55 PM9/11/14
to ang...@googlegroups.com
HI Zlatko,

Yes you can, see my first post in this thread! :)

Regards
Sander

Zlatko Josic

unread,
Sep 13, 2014, 12:13:13 PM9/13/14
to ang...@googlegroups.com
Hi,


I have tried from application A send parameter which this page:

<html>

<head>

<title>Merchant xPay</title>

<script type="text/javascript" language="javascript">

function redirect() {

document.returnform.submit();

}

</script>

</head>

<body onLoad="javascript:redirect()">

<form name="returnform" action="http://127.0.0.1:9001/#/auth" method="POST">

<input type="hidden" name="xpayTid" value="<%= request.getParameter("xpayTid") %>">

<input type="hidden" name="tid" value="<%= request.getParameter("tid") %>">

<input type="hidden" name="phN" value="<%= request.getParameter("phN") %>">

<input type="hidden" name="amt" value="<%= request.getParameter("amt") %>">

<noscript>

<center>

Please click the submit button below.<br> <input type="submit"

name="submit" value="Submit">

</center>

</noscript>

</form>

</body>

</html>



But I have got this error in browser :


Cannot POST /


Is it posible to send date like this? Is there any other way maybe?


Thanks for any idea.
Zlaja

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/vEcy_CZlvmQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages