从javascript到jsp标签获取价值

时间:2017-04-19 07:30:04

标签: javascript jsp

我有一个剧本:

function onAjaxNewOrderCountReceived() {
    // process data
    if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
       if(xmlhttp.status == 200) {
           var strOrderCount = xmlhttp.responseText;

           var orderCount = parseInt(strOrderCount.replace('"',''));
           $("#new-order-count").html(orderCount);
       } else if(xmlhttp.status == 400) {
          alert('There was an error 400');
       } else {
           alert('Error!! HTTP Code ' + xmlhttp.status + ' was returned! Unable to get count of new orders.');
       }
    }
}

我想在jsp页面中获取值orderCount。这是jsp中的代码:

<form action="orderdashboard" method="post">
    <button type="button" class="btn btn-fit-height btn-danger searchOrder">
        <strong class="new-order-count" id="new-order-count"></strong> 
        NEW ORDERS <i class="fa fa-refresh"></i>
    </button>
</form>

问题是,我没有获得要在 标记内显示的值。请帮忙。

0 个答案:

没有答案