![](/img/trans.png)
[英]Cannot get textarea value loaded with ajax using jquery in codeigniter
[英]cannot get the textarea value using with method in laravel
// post / createPlay
<div id="code">
<h2 >源代码</h2>
<textarea id="textArea" onkeyup="runCode()" >@if(isset($code)) {{$code}} @endif</textarea>
</div>
<div id="result">
<h2 >显示效果</h2>
<iframe src="about:blank" id="iFrame" contentEditable="true" ></iframe>
</div>
</div><!--end of playMain-->
//页面形式
<form action="http://localhost/html5lav/public/post/playAction" method="post">
<textarea name="playCode">
<!DOCTYPE>
<html>
<body>
<div class="circle red"></div>
<div class="circle green"></div>
</body>
</html>
</textarea>
<input type="submit" value="submit" />
</form>
// PostController中
public function createPlay(){
return View::make('frontend.post.play');
}
public function playAction(){
$code = Input::get('playCode');
return Redirect::route('createPlay')->with('code', $code);
}
//路线
Route::get('post/createPlay', array(
'uses' => 'PostController@createPlay',
'as' => 'createPlay'
));
Route::post('post/playAction', array(
'uses' => 'PostController@playAction',
'as' => 'playAction'
));
我想做的是从表单页面获取textarea值,并通过“ with”方法将“ Input :: get('playCode')”数据传输到“ post / createPlay”页面,以便在“ post” / createPlay”页面上,我们可以将数据转移到textarea(其ID为textArea)中,并通过使用js从同一页面的textarea中再次获取数据在iframe元素中进行显示。 但是我尝试了很多次,但没有成功。 变量$ code只是空的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.