如何将.ashx文件中的值返回到变量中的javascript
我正在从javascript调用ashx文件。 Http处理程序文件返回字符串值如何将.ashx文件中的值返回到变量中的javascript,javascript,httphandler,ashx,Javascript,Httphandler,Ashx,我正在从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) {
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();
});
}
});
context.response.write(字符串值);
$(窗口)。加载(函数(){
$('area')。每个(函数(){
var面积=$(此),
alt=区域属性('id');
如果(alt!=null){
面积鼠标指针(函数(){
$('dhtmltoltip').load(“Search_CS.ashx?q=“+alt”);
地址提示('',300);
}).mouseleave(函数(){
$('#dhtmltoltip').html('');
隐藏铆钉();
});
}
});
我必须在javascript的变量中接收这个字符串
如何做到这一点?我猜您没有提出任何ajax请求。这有帮助吗? 有一个名为“insertCustomerCallback”的函数调用,它将从处理程序返回html。您需要在这里编写代码。 例如
function insertCustomerCallback(html) {
//write your code
}
您是否控制HttpHandler?它设置/返回的内容类型是什么?