![](/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.