TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pushkar Pushp
NA
92
5.8k
What is the error in this code
Feb 14 2019 12:02 AM
@section Scripts {
<script>
$(".populateState").on("change", function () {
populateState($(this).val());
})
function populateState(val) {
$.getJSON('@Url.Action("GetStateList", "Buyer")' + "?value=" + val, function (result) {
$(".StateDD").html(""); // makes select null before filling process
var data = result.data;
console.log("---------" + data.length);
if (data.length != 0) {
for (var i = 0; i < data.length; i++) {
$(".StateDD").append("<option value=" + data[i].StateID + ">" + data[i].StateName + "</option>")
}
}
else {
$(".StateDD").append("<option value= 0>No State Added</option>")
populateCity(val, "country");
}
})
}
Reply
Answers (
1
)
Datatables.net Uncaught TypeError: Cannot read property 'len
storing value after Ajax function calling