0
このコードでは、ユニークなURLを使用してalpaca libraryを使用するために必要なデータフォームサーバーを取得する必要があります。このURLを組み合わせて1つのURLを持つサーバーからデータを取得する方法:jQueryはアルパカライブラリーのデータソースURLを結合します
http://127.0.0.1:8000/content_categories
私alpaca
ライブラリの実装は次のとおりです。
$("#content_categories").alpaca({
"data": [],
"schema": "http://127.0.0.1:8000/schema",
"options": "http://127.0.0.1:8000/options",
"postRender": function (control) {
$("#multiselect").parent().find("input[type=checkbox]").uniform();
}
});
と結果を送信するサーバの実装:
Route::get('/schema', function() {
echo json_encode(
["type" => 'array',
"items" =>
["type" => "string",
"enum" => ["salam", "ma"],
"minItems" => 1,
"maxItems" => 20
]
]);
});
Route::get('/options', function() {
echo json_encode(
["helper" => "یک یا چند مورد انتخاب کنید",
"type" => "select",
"id" => "multiselect",
"focus" => false,
"size" => 1]
);
});
例えば
:
Route::get('/content_categories', function() {
echo json_encode([
"schema" => ["type" => 'array',
"items" =>
["type" => "string",
"enum" => ["salam", "ma"],
"minItems" => 1,
"maxItems" => 20
]
],
"options" => ["helper" => "یک یا چند مورد انتخاب کنید",
"type" => "select",
"id" => "multiselect",
"focus" => false,
"size" => 1
]
]
);
});
さらに、フィドルデモを投稿するためのもの – alibenmessaoud