Please help me! I don’t know where am I wrong?
web.php:
Route::post('new-order-form', [OrderController::class, 'showNewOrderForm'])->name('new.order.form');
OrderController.php:
public function showNewOrderForm()
{
$products = SanPham::all();
$employees = Employee::all();
return view('order.new_order_form', compact('products', 'employees'));
}
/order/new_order_form.blade.php
/order/order.blade.php:
$(document).ready(function(){
// Hiển thị form tạo đơn hàng mới khi click
$("#newOrderBox").click(function(){
window.location.href = "{{ route('new.order.form') }}";
});
});
I tried replacing GET, POST, PUT but it didn’t work.
2
Answers
should have try any
if you have same function for view get and post you should try any method to achieved it
or use get if want to get only