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


source to share





All Articles