我正在从 javascript 调用 ashx 文件。 Http 处理程序文件返回字符串值。
context.response.write(string value);
<script type="text/javascript">
$(window).load(function(){
$('area').each(function () {
var area = $(this),
alt = area.attr('id');
if (alt != null) {
area.mouseenter(function () {
$('#dhtmltooltip').load("Search_CS.ashx?q=" +alt);
ddrivetip('', 300);
}).mouseleave(function () {
$('#dhtmltooltip').html('');
hideddrivetip();
});
}
});
我必须在 JavaScript 的变量中接收这个字符串。
如何做到这一点?
最佳答案
我猜你没有发出任何ajax请求。这是吗page帮助? 有一个名为“insertCustomerCallback”的函数调用,它将具有从处理程序返回的 html。您需要在那里编写代码。 例如,
function insertCustomerCallback(html) {
//write your code
}
关于javascript - 如何将 .ashx 文件中的值返回到变量中的 javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10084441/