Angular send messages to iframe from controller programmatically

I am trying to achieve what I want to load an iframe and send some data using the post method.

I want this to happen programmatically, so I don't want the user to click. here is the code i have come up with so far.

In my opinion I have the following:

<form id="submitValues" target="siteFrame" 
   enctype="application/x-www-form-urlencoded"
  method="POST" action="http://localhost/PHP/dataSender.php">
   <input type="text" name="jwt" ng-model="jwtData"/>
   <input type="hidden" name="name" ng-model="Hiddenname"/>
   <input type="hidden" name="type" ng-model="typeData"/>
</form>

  <iframe name="siteFrame" id="siteFrame" 
        seamless="seamless" onLoad="iframeLoadDone()"></iframe>  

      

Note that the target of the form is the iframe.

In my controller, I do this:

$scope.jwtData="someData";
$scope.Hiddenname="someData";
$scope.typeData="someData";
document.getElementById('submitValues').submit();

      

The value in the ng-model is not sent, they show up in the view if I remove the "hidden" value from the inputs.

How do I send values?

+3
javascript angularjs iframe


source to share


No one has answered this question yet

Check out similar questions:

1379
JavaScript submit request, how to submit a form
768
How to disable submit buttons
669
Remove border from IFrame
591
Calling JavaScript code in an iframe from the parent page
410
Detect when the browser is downloading files
390
How can I submit FormData objects using Ajax requests in jQuery?
288
How to pass json POST data to Web API method as object?
6
Get data from iframe after form post has finished doing file upload to target for
2
Iframe IE header dynamic name
0
Posting x-form-www-urlencoded string from HTML form



All Articles
Loading...
X
Show
Funny
Dev
Pics