如何使用Ajax更改控制器中的变量 控制器:
npm run build
Script.js
api/
如何使用ajax更改$basl = array(2018,11,18,0,0);
$deger = 3;
$baslamatarihi=Carbon::create($basl[0],$basl[1],$basl[2],$basl[3],$basl[4]);
$bitistarihi =Carbon::create($basl[0],$basl[1],$basl[2],$basl[3],$basl[4])->addDay($deger);
变量?
答案 0 :(得分:0)
您可以使用如下功能:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CalendarController extends Controller
{
public function store(Request $request)
{
$basl[2] = $request->input('basl');
}
}
Route::post('postajax','CalendarController@store');
$("a.sol").click(function() {
$.ajax({
url: '/postajax',
type: 'POST',
data: {"basl": "<what you want>"},
dataType: 'JSON',
success: function (data) {
console.log("your data changed");
}
});
}