这是视图文件脚本代码功能
function getState(val) {
$.ajax({
url: "{{ URL::to('admin/state_change') }}" + "/" + val, //url route
controller in route.php
type: "GET",
dataType: "json",
success: function (data) {
var lid = data.lawid; //getting value from controller
var scn = data.sortname; //getting value from controller
var finlawid = 'L'+scn+'C'+lid; //concatinating
$("#lm_id").val(finlawid); // Lm_id is textbox id
}
});
}
我想在下面的函数中访问一个scn变量的盖子,它存在于同一个文件中
function getStatename(val) {
if (val >= 0) {
// access lid and scn to concatinat more characters and assigned it to lm_id textbox
}
}