 |
Laravel ขออนุญาตสอบถามพี่ๆนะครับ ตอนนี้ผมติดปัญหา เรื่องการดึงข้อมูลจาก Form Popup ไปยังอีก form นึง ตามรูปนี้เลยครับ |
|
 |
|
|
 |
 |
|
ถ้า Design ในรูปแบบข้างต้นยังไม่เคยนะ
แต่ปกติจะทำ
- form จะอยู่บน .blade และเมื่อทำการ Click icon หรือ Button
- จะใช้ JSON web service ดึงค่า res มาที่ Model
- และเมื่อ Click Desciption ใน Model ค่อยนำ text row ที่เลือกกลับมาที่ input (ใช้การดึงค่า Text ใน span row ที่กำหนด)
แบ่งเป็น 2 function
1. ดึง JSON มาที่ model ให้ได้ก่อน
2. สร้าง function เมื่อคลิก Model Row ที่เลือกให้ดึงค่า text (ค่า text นะไม่ใช่ค่า value) ไปไว้ใน input
example
Code (PHP)
$('#frmCustomer').on('click','#btn',function(e){
// Open Model Bootstap
e.preventDefault();
var token='{{ csrf_token() }}'; // Token Csrf
$.ajax({
url : '{{ route('admin.customers.report') }}', // uses Controllers
type : 'post',
data :
{
_token : token,
},
success : function(res){
// res return to model
}
});
});
web
Code (PHP)
Route::post('admin/customers/report',[
'as' => 'admin.customers.report',
'uses' => 'CustomersController@report',
]);
หรือศึกษาเพิ่มเติมได้ที่ https://www.thaicreate.com/community/jquery-ajax-json.html
|
ประวัติการแก้ไข 2019-10-25 17:31:50
 |
 |
 |
 |
Date :
2019-10-25 17:26:33 |
By :
Genesis™ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณนะครับ
|
 |
 |
 |
 |
Date :
2019-10-26 05:35:09 |
By :
Topsci2016 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|