Reference: http://www.cnblogs.com/logon/p/3218834.html
We have used the iframe nested form form Post submission, very simple, but can meet the requirements of any complex situation such as get|post, the disadvantage is that there is no return value.
Add an iframe nested to the desired place and plug it into the hidden form form, and then get the value of the login form to give to the hidden form form submission to complete the cross-domain post|get submission.
functionSmal_send () {varUser = $ ("#user_name"). Val (); varPass = $ ("#password"). Val (); varForm =$ ("<form action= ' http://www.demo.com/login.php ' method= ' post ' >" + "<input type= ' hidden ' name= ' us Er_name ' value= '/> ' + ' <input type= ' hidden ' name= ' password ' value= '/> ' + ' </form> "); $( "#SMAL"). Remove ();//emptying Nodes$ ("Body"). Append ("<iframe id= ' SMAL ' name= ' SMAL ' style= ' Display:none ' ></iframe>");//loading an IFRAME(function(){ $( "#SMAL"). Contents (). Find (' body '). HTML (form);//plug the form form into the IFRAME;$ ("#SMAL"). Contents (). Find ("form input[name= ' user_name ']"). val (user); $( "#SMAL"). Contents (). Find ("form input[name= ' password ']"). Val (pass); $( "#SMAL"). Contents (). Find (' form '). Submit ();//Submit [PS, here is submitted to demo.com, cross-domain] }()); SetTimeout (function(){//jump to demo.com if you need towindow.location.href= "http://www.demo.com/index.php"; },100)}
JavaScript is about to reverse the heavens. Yes, well, I think it's.
Reference:
1:http://huangqiqing123.iteye.com/blog/1754108
2: Here's a basic cross-domain commit method http://blog.csdn.net/china_skag/article/details/7410918
3: Group Friends discussion.
4: Divergent knowledge Points: http://www.cnblogs.com/yjmyzz/archive/2011/04/26/2029699.html
&&
functionpayorderbook (URL, pmap) {varKey, Val, hidden; varformId = ' Dsppayform ' +NewDate (). GetTime ();varForm = $ (' <form action= "' + URL + '" method= "POST" name= "' + formId + '" id= "' + formId + '" ></form> ');if(pmap) { for(KeyinchPmap) { if(Pmap.hasownproperty (key)) {hidden= $ (' <input type= "hidden" name= "' + key + '"/> '); Hidden.val (Pmap[key]); Hidden.appendto (form); }}}//Set Attributes$ (form). CSS (' position ', ' absolute '); $ (form). CSS (' Top ', ' -1200px '); $ (form). CSS (' Left ', ' -1200px '); $ (form). AppendTo (' Body '); $ (form). Submit (); }
The transfer method is changed from URL carrying to post submission