Solve the Problem of loading iframe to the parent class. If the src parameter is too large, the loading fails.
<Iframe src = "*******. do? Param = *** "id =" leftFrame "name =" leftFrame "frameborder =" 0 "> </iframe>
Or load src using js:
Var params = "? Pk_id = "+ pk_id;
Var frameLeftSrc = "<% = path %>/*****. do" + params;
$ ('# LeftFrame'). attr ("src", frameLeftSrc );
(This is just an example. There may be multiple parameters. Continue)
The above two methods can be used to load iframe. We may think it is correct. In fact, the above writing method is indeed not too big a problem, for the parameter value is not long, pay attention to the length of the parameter value, not the number of parameters. For example, I want to pass a parameter named pk_id to this iframe. The value is the value spliced by a long string of primary keys returned on the home page or other pages, with at least 3000 characters, at this time, we can use this method to access the database. Because this url method is submitted through get, the parameter length is limited.
So what should we do when we use big data transmission? I have two ideas at the moment (if you have any better suggestions, please refer to them for mutual communication and mutual improvement ):
1. It is still transmitted in this way, but the parameter value should not be too long, provided that the parameter value that is not long can be queried through association to obtain the desired long parameter value, in this way, after the iframe receives the not long parameter value, you can find a way to obtain the long parameter value you want on the iframe subpage. (This can be used, but it is not recommended because it requires a prerequisite)
2. Load the iframe page on the home page using the following methods:
Home page: <iframe src = "about: blank" id = "leftFrame" name = "leftFrame" frameborder = "0">
Js:
Var url = "<% = path %>/pubitem/toChoosePubItemLeft. do"; // define the action of the form on the iframe page
// Define the form
Var html1 = '<form id = "queryForm" name = "queryForm" method = "post" target = "_ self" action = "' + url + '">' +
'<Input type = "hidden" id = "pk_id" name = "pk_id" value = "' + pk_id + '"/>' + // pk_id is a length longer than 3000 characters value
'</Form> ';
Document.getelementbyid('leftframe'{.content}{doc ument. write (html1); // write the form to iframe
Document.getelementbyid('leftframe'{.content}w.doc ument. getElementById ('queryform'). submit (); // execute the form submission in iframe
Encapsulate the above method into a method, and call this method when loading the home page, the big data on the home page will be passed to the iframe page.