Problem using $.ajax method of jquery
When we use $.ajax method then sometime we use this in side success method we get unexpected error because in $.ajax method in success property this has different meaning it refers to xmlhttprequest object other then we are expecting. Here is an example and solution for that: Example: $("#location").change(function () { if ($(this).val() == "-1") { $("#category").prop('disabled', 'disabled'); } var that = this; $.ajax({ type: "POST", url: "/Home/Category", data: JSON.stringify({ projectId: $("#project").val(), locationId: $(this).val() }), ...