0

I have the below java script function, the global variable description1 is updated in the nested JQuery, But when i try to display the variable or set the result as text for a label, it is not displayed. Kindly advice. Thanks in advance.

<script type="text/javascript">
var description1 = "";

function onSelect(e) {
    var item = e.item;
    var partcode = item.text();

    $.ajax({
        url: '@Url.Action("GetDescription", "Orderlist")',
        type: 'GET',
        dataType: 'json',
        cache: false,
        data: { 'id': partcode },
        success: function (results) {
            description1 = results;
        },
         error: function () {
            alert('Error occured');
        }
     });

    alert("DESC: " + description1)

    document.getElementById("TechDescription").innerHTML = description1;
}
Soft Ware
  • 3
  • 1

0 Answers0