我正在尝试验证链接标识符输入字段,当用户输入已经存在于数据库中的数据时,如果用户输入与链接相关的新数据,则弹出警报链接,因此代码将允许用户sava数据,但此代码为不工作我不知道我在哪里做错了请帮助我。
//HTML
<div ng-dropdown-multiselect="example65data" id="xyz"//Can Be Anything options="example65data" selected-model="example65model"></div>
//JS
$scope.example65model= [];
function abc//Can Be Anything() {
var allData = hrmsService.getdata//Service Function Call();
allData.then(function (//Take any variable//pqr) {
DataObj = [];
for (var i in pqr.data) {
item = {}
item["id"] = pqr.data[i].Id//Primary Key;
item["label"] = apiSkills.data[i].Description//Any Description Field;
DataObj.push(item);
}
$scope.example65data= DataObj;
}, function () {
alert("Data Not Found");
});
}
<input type="text" name="txtLinkIdentifier" id = "txtLinkIdentifier" class="form-control" placeholder="Link Identifier" onblur="checkLinkId();" />
function checkLinkId() {
var idValue = $("#txtLinkIdentifier").val();
$.ajax(
{
data: {action: 'Check'},
method: "POST",
url: "LinkPiuServlet?idvalue=" + idValue,
dataType: 'json',
success: function (data) {
if (data.success)
{
alert(data.msg);
}
}
});
else if (action.equals("Check")) {
String txtLinkIdentifier = request.getParameter("idvalue");
boolean res = LinkPiuDao.checkId(txtLinkIdentifier);
if (res == true) {
jsonObj.addProperty("success", true);
jsonObj.addProperty("msg", "Link Id Already Exist");
}