I want to create a dynamic query
(Select * from <table name> where ..)
using angular js, html, javascript
. The drop-down should come for the conditions ('and' , 'or', etc)
e.g. -> select <dropdown> from <dropdown> where <dropdown>
. I am new to it. So please explain in proper example.
我想使用angular js,html,javascript创建一个动态查询(从
1 个解决方案
#1
0
$.ajax({
type: 'POST',
url: 'DropDownController',
dataType: 'json',
success: function(result) {
$.each(result, function() {
$("#drpDown").append(
$('<option/>', {
value: this,
html: this
})
);
});
}
});
What happens at the endpoint is some controllerDropDownController
may be if you are using Spring MVC
it would be something like /DropDownController
where you can write you query to call database
using orm
or whatever you use and returned is json
which binds to the dropdown with id="drpDown"
在端点上发生的是一些controllerDropDownController可能是你正在使用Spring MVC它会像/ DropDownController那样你可以写你使用orm调用数据库或者你使用的任何东西,并返回json,它绑定到下拉列表id = “drpDown”
#1
0
$.ajax({
type: 'POST',
url: 'DropDownController',
dataType: 'json',
success: function(result) {
$.each(result, function() {
$("#drpDown").append(
$('<option/>', {
value: this,
html: this
})
);
});
}
});
What happens at the endpoint is some controllerDropDownController
may be if you are using Spring MVC
it would be something like /DropDownController
where you can write you query to call database
using orm
or whatever you use and returned is json
which binds to the dropdown with id="drpDown"
在端点上发生的是一些controllerDropDownController可能是你正在使用Spring MVC它会像/ DropDownController那样你可以写你使用orm调用数据库或者你使用的任何东西,并返回json,它绑定到下拉列表id = “drpDown”