刚写了段AJAX,测试的时候无论如何都没有结果,问题在哪啊?
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>AJAX_Test</title>
</head>
<body>
    <form name="myForm">
        输入关键字:<input type="text" name="key" onkeyup="search(this.value)"><br>
        图书信息:<span id="txtHint"></span>
    </form>

    <script type="text/javascript">
    var xmlHttp;
    var key;
    function search (value) {
        // body...
        try{
            xmlHttp = new XMLHttpRequest();
        }catch(e){
            try{
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }catch(e){
                try{
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e){
                    alert("你的浏览器不支持AJAX!");
                    return false;
                }

            }
        }
        key = value;
        url = "books.xml";
        xmlHttp.onreadystatechange=myfunc;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }

    function myfunc(){
        if (xmlHttp.readyState==4) {
            var xmlStr = xmlHttp.responseText;
            xmlStr = parse(xmlStr);
            document.getElementById("txtHint").innerHTML = xmlStr;
        }
    }

    function parse(xmlStr){
        var xmlDoc = null;
        if(window.ActiveXObject){
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        }else if (document.implementation.createDocument()) {
            xmlDoc = document.implementation.createDocument("","",null);
        }else{
            alert("浏览器不能处理!");
        }
        var tableStr = "";
        if (xmlDoc!=null) {
            xmlDoc.async=false;
            xmlDoc.loadXML(xmlStr);
            tableStr+="<table border='1'>";
            var x = xmlDoc.getElementsByTagName("book");
            for(i=0;i<x.length;i++){
                var name = x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue;
                var price = x[i].getElementsByTagName("price")[0].childNodes[0].nodeValue;
                var author = x[i].getElementsByTagName("author")[0].childNodes[0].nodeValue;
                var year = x[i].getElementsByTagName("year")[0].childNodes[0].nodeValue;                
                if(name.indexOf(key)==-1)continue;
                tableStr+="<tr>";
                tableStr+="<td>"+name+"</td>";
                tableStr+="<td>"+price+"</td>";
                tableStr+="<td>"+author+"</td>";
                tableStr+="<td>"+year+"</td>";
                tableStr+="</tr>";
            }
            tableStr+="</table>";
        }
        return tableStr;
    }
    </script>
</body>
</html>

上面是网页代码,输入任何关键字都没反应啊,books.xml文件是没有错的,

 <?xml version="1.0" encoding="utf-8"?>
<books>
    <book isbn="13452728">
        <name>《水浒传》</name>
        <price>80</price>
        <author>施耐庵</author>
        <year>元末</year>
    </book>
    <book isbn="78789779">
        <name>《西游记》</name>
        <price>90</price>
        <author>吴承恩</author>
        <year>明代</year>
    </book>
    <book isbn="36734598">
        <name>《三国演义》</name>
        <price>75</price>
        <author>罗贯中</author>
        <year>元末</year>
    </book>
    <book isbn="63458728">
        <name>《红楼梦》</name>
        <price>79</price>
        <author>曹雪芹</author>
        <year>清代</year>
    </book>
</books>

是不是代码的问题,还是在tomcat的文件夹缺少东西?小白第一次接触AJAX,求助!图片说明图片说明

1个回答

   window.bz = {};

    (function (obj) {

        obj = {};

        //创建xmlhttprequest对象

        obj.createXMLHttpRequest = function () { if (window.ActiveXObject) { var aVersions = ["MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0", "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp", "Microsoft.XMLHttp"]; for (var i = 0; i < aVersions.length; i++) { try { return new ActiveXObject(aVersions[i]); } catch (oError) { continue; } } } else if (window.XMLHttpRequest) { return new XMLHttpRequest(); } throw new Error("XMLHttp object could not be created."); }

        //ajax

        obj._xmlHttp = null;

        obj.ajax = function (options) {

            try {
                if (options["sync"] != undefined) {
                    obj._xmlHttp.open(options.method, options.url, options.sync);
                } else {
                    obj._xmlHttp.open(options.method, options.url, true);
                }
                obj._xmlHttp = this.createXMLHttpRequest();

                obj._xmlHttp.setRequestHeader("cache-control", "no-cache");

                obj._xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

                obj._xmlHttp.onreadystatechange = function () {
                    var _response = "";
                    if (obj._xmlHttp.readyState == 4) {

                        if (obj._xmlHttp.status == 200) {
                            if (options["dataType"] == undefined) {
                                _response = obj._xmlHttp.responseText;
                            } else {
                                switch (options.dataType.toLowerCase()) {

                                    case "json":

                                        _response = eval(obj._xmlHttp.responseText);

                                        break;

                                    case "xml":

                                        _response = obj._xmlHttp.responseXML;

                                        break;

                                    case "html":

                                        _response = obj._xmlHttp.responseText;

                                        break;

                                    default:

                                        _response = obj._xmlHttp.responseText;

                                        break;

                                }
                            }



                            options.success(_response);

                        }

                    }

                    else {
                        if (options[""] != undefined) {

                        }
                        alert("ajax 提交失败");
                    }

                }
                if (options["data"] == undefined) {
                    obj._xmlHttp.send(data);
                } else {

                    var data = options.data
                    bz.isJson = function (obj) {
                        var isjson = typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
                        return isjson;
                    }
                    if (bz.isJson(data)) {
                        var a = "";
                        for (var i in options.data) {
                            a += i + "=" + options.data[i] + "&";
                        }

                        obj._xmlHttp.send(a);
                    } else {
                        obj._xmlHttp.send(data);
                    }

                }




            }

            catch (e) {
                alert(e.message);

            }

        }


        //对象引用

        bz = obj;


    })(bz);
rapcoding
scoobym 谢谢,可是还是不明白问题出在哪里,难道应该把那个responseText改成responseXML,可是改了也不管用啊,
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
在程序错误的时候,本地无论如何都报错,服务器无论如何都不报错
我本地电脑是XP系统,服务器是server 2003。rn地方写个登陆的程序,故意不连接数据库,在本地web.config设置,无论设置customErrors为On、Off或者RemoteOnly都能报错rn但是在服务器是无论如何设置customErrors都不能报错。rnrn这么才能让服务器是也报错呢??
刚写了段转换金额的代码,大家看看
欢迎指教!rn Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickrnrn Dim str As Stringrn str = Me.TextBox1.Text.Trimrn Dim isfs As Booleanrn If Left(str, 1) = "-" Thenrn isfs = Truern str = str.Remove(0, 1)rn Elsern isfs = Falsern End Ifrn Dim strpoint As Stringrn Dim point() As Stringrn Dim j As Int16rn Dim jj() As Stringrn Dim jjj As Stringrn jjj = ""rn If str.IndexOf(".") <> -1 Thenrn point = Split(str, ".", -1, CompareMethod.Text)rn str = point(0)rn strpoint = point(1)rn ReDim jj(strpoint.Length - 1)rn For j = 0 To strpoint.Length - 1rn jj(j) = Left(strpoint, 1)rn strpoint = Right(strpoint, strpoint.Length - 1)rn jjj = jjj + convert(jj(j))rn Nextrn End Ifrn Dim strcode As Stringrn strcode = ""rn While strcode.Length <= str.Lengthrn strcode = strcode & "2345" & "2346"rn End Whilern strcode = "1" & strcodern strcode = Left(strcode, str.Length)rn Dim i As Int16rn Dim a() As Stringrn Dim strcode1 As Stringrn Dim countstr As Int16rn Dim strcode2 As Stringrn countstr = strcode.Lengthrn ReDim a(strcode.Length - 1)rn For i = 0 To countstr - 1rn a(i) = Right(strcode, 1)rn strcode = Left(strcode, strcode.Length - 1)rn strcode1 = strcode1 & a(i)rn strcode2 = strcode2 & "," & Mid(str, i + 1, 1) & Mid(strcode1, i + 1, 1)rn Nextrn strcode2 = Right(strcode2, strcode2.Length - 1)rn Dim newstr() As Stringrn newstr = Split(strcode2, ",", -1, CompareMethod.Text)rn Dim ii As Int16rn Dim laststr As Stringrn Dim strcode3 As Stringrn Dim leftstr As Stringrn Dim rightstr As Stringrn For ii = 0 To newstr.Length - 1rn strcode3 = newstr(ii)rn leftstr = Left(strcode3, 1)rn rightstr = Right(strcode3, 1)rn rightstr = Replace(rightstr, rightstr, convert2(rightstr))rn leftstr = Replace(leftstr, leftstr, convert(leftstr))rn If leftstr = "零" And (rightstr = "拾" Or rightstr = "佰" Or rightstr = "仟") Thenrn rightstr = ""rn End Ifrn If leftstr = "零" And (rightstr = "万" Or rightstr = "亿") Thenrn leftstr = ""rn End Ifrn strcode3 = leftstr & rightstrrn laststr = laststr & strcode3rn Nextrn While laststr.IndexOf("佰零万") <> -1rn laststr = laststr.Replace("零万", "万")rn End Whilern While laststr.IndexOf("仟零零万") <> -1rn laststr = laststr.Replace("零零万", "万")rn End Whilern While laststr.IndexOf("零万") <> -1rn laststr = laststr.Replace("零万", "零")rn End Whilern While laststr.IndexOf("零亿") <> -1rn laststr = laststr.Replace("零亿", "亿")rn End Whilern While laststr.IndexOf("零零") <> -1rn laststr = laststr.Replace("零零", "零")rn End Whilern While Right(laststr, 1) = "零"rn laststr = Left(laststr, laststr.Length - 1)rn End Whilern If isfs = True Thenrn laststr = "负" & laststrrn End Ifrn If jjj = "" Thenrn TD2.InnerHtml = laststrrn Elsern If laststr = "" Thenrn TD2.InnerHtml = "零点" & jjjrn Elsern TD2.InnerHtml = laststr & "点" & jjjrn End Ifrn End Ifrnrn End Subrnrn Function convert(ByVal num As String)rn Select Case numrn Case "1"rn convert = "壹"rn Case "2"rn convert = "贰"rn Case "3"rn convert = "叁"rn Case "4"rn convert = "肆"rn Case "5"rn convert = "伍"rn Case "6"rn convert = "陆"rn Case "7"rn convert = "柒"rn Case "8"rn convert = "捌"rn Case "9"rn convert = "玖"rn Case "0"rn convert = "零"rn End Selectrn End Functionrn rn Function convert2(ByVal num As String)rn Select Case numrn Case "1"rn convert2 = ""rn Case "2"rn convert2 = "拾"rn Case "3"rn convert2 = "佰"rn Case "4"rn convert2 = "仟"rn Case "5"rn convert2 = "万"rn Case "6"rn convert2 = "亿"rn End Selectrn End Function
无论如何,还是,无论如何
刚才看完system design课件的最后一章的最后一页正好是12点整。我们正式进入了9月,而按照8月初的计划,我们本可以在8月30日决战,现在已经推到了8日。无论如何,还是,无论如何,再还是,无论如何,抓紧每一分,每一秒,请好好努力,好好珍惜,全力以赴,务求最好! Work hard,Good luck!
写了段javascript代码,结果发现有兼容性问题,请求高手指正。
写了段js代码,完整的Htm如下:rn[code=HTML]rnrnrn rnrnrnrn rn 测试栏 rn 父行rn 子行rn 子行rnrnrnrnrn[/code]rnrn我的意图是通过点击“父行”来隐藏和显示两个“子行”rn在Chrome和Firefox中能够看到预想中效果,但在IE中没有反应,估计是兼容性问题rn但由于刚开始接触javascript,找不到症结所在,特此发帖请求高手解决。
刚写了一个 模仿百度贴吧的网站,大家来测试测试啊.
http://124.132.143.251/ok.php rnrnrnrn 新年快乐
请大家无论如何帮帮忙啊!!
在VB头定义了一个函数,用来执行SQL语句,如下rnPublic Function transactsql(ByVal sql As String) As adodb.RecordsetrnrnDim con As ADODB.connectionrnDim rs As ADODB.recordestrnDim strconnection As StringrnDim strarray() As StringrnSet con = New ADODB.connectionrnSet rs = New ADODB.recordestrnOn Error GoTo transactsql_errorrn strconnection = "privider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\Administrator\My Documents\eaxm.mdb"rn strarray = Split(sql)rn con.open strconnectionrn If StrComp(UCase$(strarray(0)), "select", vbTextCompare) = 0 Thenrn rs.open Trim$(sql), con, adopenkeyset, adlockoptimisticrn Set transactsql = rsrn iflag = 1rn Elsern con.execute sqlrn iflag = 1rn End Ifrntransactsql_exit:rnSet rs = NothingrnSet con = Nothingrntransactsql_error:rnMsgBox "查询错误"rniflag = 2rnResume transactsql_exitrnEnd Functionrnrn但是系统老是告诉我adodb.recordset是无效的。是不是还要先定义adodb.recordset的啊?请大家告诉我。rnrnrn
写了段文本处理的python代码,请教点问题
[code=Python]import osrnimport sys rnimport stringrnimport getoptrnimport rernf=open('xx.log','r+')rnfor s in f.readlines():rn temps=string.splitfields(s, '|')rn print re.findall('dev',temps[1])rnif re.findall('beta|dev',temps[1]):rn print srnf.close[/code]rnrn以上我是要用re.findall的结果来做一个判断,如果匹配到了就打印s的值?为什么不成功呢?求解!
请问段代码错在哪?
我在全局变量定义游标rnDECLARE cursor1 CURSOR FORrnSELECT no,rn name,rn work,rn worktelrnfrom customer; rnstring nornstring namernstring workrnstring worktelrnrn以下是错误提示:rndatabase C0038:SQLSTATE=37000■[SYBASE][ODBC Driver][Adaptive Server Anywhere]Syntax error or access Violation:near 'work' in no,name[work],worktel from...rnrn
写了语段无聊的程序!!!
各位大侠: 我的问题是:用directory.getfile("\\服务器名\共享文件名"),然后遍历到listdata里。 但我希望用访问者的账号去访问文件夹,以便可以用共享文件夹权限控制的方式,控制访问。另 我们的环境是域环境 我用 User.Identity.Name;得到了用户名 ,但 不知道怎么使 求解啊 ???
AJAX一步测试问题
rn rnrnrn
刚买的ajax书,有些郁闷啊.........
我买了本<>,陈黎夫译的,rn从网上买的时候没太在意,现在看了才发觉这本书好像有些过时了吧,rnScriptManager控件标签这本书里面还都是这样的:rn唉,现在有些后悔啊,所以想问下看过这本书的朋友,觉得怎么样,相对于现在来说,里面的技术有比较多的过时吗?rnrn
ajax返回的时候的问题
如: 返回的时候rnalert(xmlHttp.responseText)的时候rn有的时候是返回的正确的rn有的时候返回的一个莫名其妙的html页面的代码rn各位大虾碰到过没有rn碰到后又是如何解决的了????rn指教下..............
刚接触ajax,菜鸟问题
例如 :访问服务器上 test.html,服务器收到请求后,把test.html、相关js文件回传给了浏览器,test.html里面还有ajax,又开始向服务器请求数据,数据到达后,页面显示处理。rnrn我不知道描述的过程是否是正确的,现有几点问题:rnrn1、在.net下,建立什么文件可以处理该请求?rn2、在.net下,怎么响应ajax请求,要创建什么文件?rn3、我见过访问ashx,如:http://192.168.1.200:8000/system/login.ashx,rn在服务端我可以添加一个login.ashx,然后在public void ProcessRequest(HttpContext context)里面处理请求。rn那么,如果请求的是 http://192.168.1.200:8000/system/login.html,我要创建什么文件来处理这个请求?
测试的时候发现的问题
Oracle的子查询:alter table myemp as select * from emp;java中Object类中可以操作线程的方法:wait() 、notify()、notifyAll()其他问题待总结······
Junit4测试时候的问题
public class DrawDao extends HibernateDaoSupport rnrn /**rn * 添加领用申请rn * rn * @param drawrn * 领用申请信息(不可为null)rn * @returnrn */rn @SuppressWarnings("unchecked")rn public boolean insertDraw(Carddrawapply draw, List drawdetailList) rn boolean flag = false;rn Session session = null;rn Transaction tx = null;rn try rn session = this.getSession();rn tx = session.beginTransaction();rn rn long shopid = MyConstant.HTDZ_DEFAULT_SHOPID;//商家IDrn String billtype = CardConstant.CARD_LY_ID;//业务编号rn String engshort = MyConstant.HTDZ_STR;//商家英文简称rn String busishort = CardConstant.CARD_LY_CODE;//业务英文简称rn rn String formcode = CardCode.getFormCode(session,shopid,billtype,engshort,busishort);rn if(!"".equals(formcode))rn draw.setCarddrawapplycode(formcode);rn draw.setSourcetype("0");rn draw.setApplydate(MyFormat.getToday());rn draw.setStatus(StatusUtil.CARDDRAWAPPLY_STATUS01);rn session.save(draw);rn long carddrawapplyid = draw.getCarddrawapplyid();rn session.flush();rn if(drawdetailList.size()==0)rn tx.rollback();rn elsern for(Carddrawapplydetail drawdetail : drawdetailList)rn if(drawdetail!=null)rn drawdetail.setCarddrawapplyid(carddrawapplyid);rn session.save(drawdetail);rn rn rn tx.commit();rn flag = true;rn rn rn rn catch (Exception e) rn e.printStackTrace();rn tx.rollback();rn flag = false;rn finally rn session.close();rn rn return flag;rn rnrnrn以上Dao的方法已经正常。rn对此方法的测试,我是在后期补上的。但是居然报错。帮我看看:rnrnJunit4:(不用继承TestCase)rnrnpublic class TestDrawDaorn rn private DrawDao drawDao;rn rn @Beforern public void setUp()rn drawDao = new DrawDao();rn rn rn rn /**rn * 测试'卡领用申请信息的添加'rn */rn @Testrn public void testInsertDraw()rn Carddrawapply draw = new Carddrawapply();rn draw.setApplyoperid(1);rn draw.setApplydesc("申请说明");rn rn List drawdetailList = new ArrayList();rn rn //IC卡,100元面值的100张rn Carddrawapplydetail drawdetail1 = new Carddrawapplydetail();rn drawdetail1.setCardtype("1");rn drawdetail1.setParvalue(100);rn drawdetail1.setAmount(100);rn //充值卡,50元面值的50张rn Carddrawapplydetail drawdetail2 = new Carddrawapplydetail();rn drawdetail2.setCardtype("2");rn drawdetail2.setParvalue(50);rn drawdetail2.setAmount(50);rn rn drawdetailList.add(drawdetail1);rn drawdetailList.add(drawdetail2);rn rn boolean flag = drawDao.insertDraw(draw, drawdetailList);rn //断言rn Assert.assertEquals(true,flag);rn rnrnrn异常如下:rnjava.lang.NullPointerExceptionrn at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:142)rn at com.htdz.card.admin.dao.DrawDao.insertDraw(DrawDao.java:35)rnrn也就是调用到DrawDao里insertDraw()的这句时报错:session = this.getSession();rnrn业务类里调用这个Dao都能正常使用,为什么从测试类里调用就报这个错误?rnDrawDao继承了HibernateDaoSupport了啊。
一上午都没有结果,关于导入问题
使用的数据库是oracle7.3.3,现在从oracle网站上下了一个8.1.7,可是oracle7.3.3导出的expdat.dmp不能用oracle8.1.7的impot工具还原,期待解答... rn
j2ee配置问题,问题不大,一天都没有结果
请问 rnj2se 装在从:c:\j2sdk1.4.2 j2ee装在 c:\Sun\AppServer rn环境变量的设置如下: rnJAVA_HOME;C:\j2sdk1.4.2 rnJ2EE_HOME:C:\Sun\AppServer rnpath:C:\Sun\AppServer\bin;C:\j2sdk1.4.2\bin; rnclasspath:.;C:\Sun\AppServer\lib;C:\Sun\AppServer\lib\j2ee.jar;C:\j2sdk1.4.2\lib\tools.jar;C:\j2sdk1.4.2\lib;C:\Sun\AppServer\lib\j2eetools.jar; rn哪里错了啊 j2ee装的是1.4 rn输入 asadmin start rn显示 CLI001 Invalid Command,start.Use "asadmin help"for a list of valid commands.rnj2ee不是内部或外部命令rn我把系统都从装了,还是不管用,哥哥姐姐们帮帮小弟啊
刚装上JDK 6写了一个Hello 程序测试出错!
exception in thread "main"java.lang.nosuchmethoderror:main
刚学JAVA 写了个binary search tree, 编译没错, 可测试没有结果[求救]
public class node rn public int key;rn public node left, right;rn public node(int k, node l, node r) rn key = k;rn left = l;rn right = r;rn rn rnrnpublic class bst rn private node root;rn public bst() rn root = null;rn rn protected void insert_aux(node n, int x) rn if(n==null)rn n = new node(x, null, null);rn else if(x < n.key)rn insert_aux(n.left, x);rn else if(x > n.key)rn insert_aux(n.right, x);rn //else x is in the tree alreadyrn rn public void insert(int x) rn insert_aux(root, x);rn rn protected void inorder_aux(node n) rn if(n!=null) rn inorder_aux(n.left);rn System.out.print(n.key+" ");rn inorder_aux(n.right);rn rn rn public void inorder() rn inorder_aux(root);rn System.out.println();rn rn rnrnpublic class test rn public static void main(String args[]) rn bst t = new bst();rn int a[] = 4, 2, 8, 7, 5, 1, 9, 6, 0, 3;rn for(int i=0; i<10; i++)rn t.insert(a[i]);rn t.inorder();rn rn rn
刚接触XSL,请问下面问题在哪??
rn rn rn无显示!!!!
vs2005 Ajax 控件在哪下
在微软.com下了ASP.NET 2.0 AJAX Extensions 1.0 安装后只有5个控件.rn而我以前看到别人Ajax Extensions里的还包括了Validator、DropDownExtender、ReorderList等控件。在网上搜了半天也没搜到。。谁告诉下是在哪下的?
《AJAX实战》源码?在哪下?
找不到源码,请问哪里有下啊?
晕倒了,写了段简单vbs,可是为什么有错啊~~
-
ajax url不会写了!!!
window.onunload = function(loginName,sessionId) rn var loginName="$loginName";rn var sessionId="$sessionId";rn var data="loginName="+loginName+"&sessionId="+sessionId;rn var url="$ctx/admin/tracker!set-logout-time.action";rn alert(loginName);rn alert(url);rn $.ajax(rn url:url,rn type:"post",rn data:data,rn success:function()rn return "退出!"; rn rn rn );rn rn主要功能是关闭浏览器时调用方法来保存用户退出时间。rn这段代码哪里有问题啊?看了一下午,也没发现!有点蒙了!rn求大神帮助啊!谢谢了!!
Ajax测试
1 什么是AJAX=HMTL+CSS+JS+DOM+XHR    1)传统Web应用是以请求->等待响应->请求->等待响应->....的过程,叫同步请求/操作    2)现代Web应用是以请求->请求->请求->响应->响应->响应->...,叫异步请求/操作    3)现代Web应用以Ajax为主流,Ajax=C/S表面现象+B/S本质 ajax初体验
使用ajax什么反应都没有
我有一个注册会员的界面,初始界面在member_register.php的index函数,点击注册按钮就到member_resiter.php的sendMailingListRequest函数,结果什么反应也没有。rn我在sendMailingListRequest里面echo什么都没有输出。rnajax部分:rn[code=javascript]$(document).ready(function() rn $('#btnSave').click(function() if(check_name('First_name')&&check_name('Last_name')&&check_email()&&check_captcha()&&check_phonenumber())rnrn$.ajax(rntype: 'POST',rnURL: site_url+'/member_register/sendMailingListRequest',rndata: $('#btnSave').serialize(),rndataType: 'json', success:function(data) alert(data);rnvar error_message=false; $.each(data,function(index,item) if(index=="status_code") if(item=="400 Bad request") error_message=true; if(item=="200 OK")rnerror_message=false; rn else if(index=="json") if(error_message) $('#error_message').text(item.notification.message); $("#error_message").fadeIn(3000);rnreloadCaptcha();rn$("#error_message").fadeOut(3000);rn elsern$('#success_message').text(item.notification.message);rn$("#success_message").fadeIn(3000);rnreloadCaptcha();rn$("#success_message").fadeOut(3000);rn$('#First_name').val("");rn$('#Last_name').val("");rn$('#email').val("");rn$('#mobile').val("");rn$('#captcha').val("");rnrnrn ) rn,rnerror: function(response)rnrn);rnrn);[/code] rn检查有效性的地方没有问题,因为可以走到success:function(data) 然后跳到error
救命啊,问题出在哪?
写了一个java的程序,读取文件的数字,可是不知道哪里有个exception了,请高手指点:rn这是data.txtrnrn1.25 0rn-1.25 2rn0.0 0 rn-1.25 0rn1.0 2rn0.0 0 rn3.33 -1rn-1.375 1rn1.0 2rn1.0 1rn0.0 0 rn-4.75 2rn-3.0 -2rn3.0 2 rn0.0 0rnrnrn[code=Java]rnimport java.util.*;rnimport java.io.*;rnrnpublic class testrnrnrn public static void main(String[] args) //throws Exceptionrn rn rn tryrn double tmpCoef;rn int tmpExpo;rn BufferedReader br = new BufferedReader(new FileReader(new File("data.txt")));rn String sLine = "";rn int flag = 0;rnrn rn while ((sLine = br.readLine()) != null)rn rn //System.out.println(flag);rn String[] ss = sLine.split(" ");rn tmpCoef = Double.parseDouble(ss[0]);rn tmpExpo = Integer.parseInt(ss[1]);// reads from the filern //System.out.println(tmpCoef+" "+tmpExpo);rnrn //double absTmpCoef = absValue(tmpCoef);rn //now stores it to the polynominalrn if ( tmpExpo != 0 ||tmpCoef !=0.0 )rn rn if (flag == 1)rn rn //store the data into arn System.out.println("a: "+flag);rn //a.display();rn rn else if (flag == 2)rn rn rn //store the data into brn //b.addTerm(tmpCoef, tmpExpo);rn System.out.println("b: "+ flag);rnrn rn else if (flag == 3)rn rn //store the data into crn //c.addTerm(tmpCoef, tmpExpo);rn System.out.println("c: "+ flag);rn rn else if (flag ==4)rn rn //store the data into drn //d.addTerm(tmpCoef,tmpExpo);rn System.out.println("d: "+ flag);rn rn elsern rn break;rn rn rn rn rn if (tmpCoef == 0.00 && tmpExpo == 0)rn rn flag++;rn //continue;rn rnrn rn rnrn rn rn catch(Exception e)rn rn System.out.println("exception caught");rn rn rnrnrn rnrn[/code]
求助啊!!!刚学ASP,在连接数据库的时候碰到了问题
每次都出这个错误rnrnMicrosoft OLE DB Provider for ODBC Drivers (0x80004005)rn[Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序rn/ASP本地/chap7/7-1.asp, 第 12 行rnrn代码应该没错,因为是书的配套光盘里的文件,数据库文件也有rnODBC也设置过了(不知道设置对了没有,书上这个讲的很少,自己设置的),到底是不是ODBC的问题???如果是,那要怎么设置???我要连SQL或者ACCESS的数据库rnrn望高人给小弟指点,谢谢!!!!!
骗人啊,什么都没有!
根据JAVASCRIPT深入浅出一书,这个方法可以得到返回的数据:lucky,rn但我什么也没看到啊,兄弟们帮我检查一下,谢谢!rnrn[code=html]rnrn rnrnrnrnrn rnrnrn[/code]
分布式tensorflow测试 结果及问题
分布式TensorFlow+GoogleNet+between-graph模式+异步更新 先写测试结果出来后的问题,希望有经验的大牛或者正在研究的能够解答,或者提供想法和建议: 1. 测试结果是否正确,从测试结果看各个worker节点的性能是不一样的,差异比较明显(相差3倍以上)。 2. 最后的性能(运行时间)是如何统计(我在这里是取的平均值) 3.如果按我算的平均值的结果来看
请教测试查询结果问题
现在写了两个类connDB.java和statementExp.javarn 其中connDB.java是用来连接数据库和关闭数据库连接的。这个类正确,已通过测试rn statementExp.java是用来执行查询语句的。这个类有错误,在调试时,main函数中的rs 显示 BaseResultSet ,这是为什么啊,我不明白,还请高手指导,多谢!代码如下:rnrnrnrnpackage com.phy.db;rnrnimport java.sql.Connection;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnrnimport com.phy.db.connDB;rnrnrnpublic class statementExp rnrn /*功能:执行查询语句*/rn public ResultSet executeQuery(String sql) rn Connection conn=null;rn Statement stmt=null;rn ResultSet rs=null;rn conn=connDB.getConnection();rn try rn stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);rn rs = stmt.executeQuery(sql);rn catch (SQLException ex) //捕获异常rn System.err.println(ex.getMessage());rn finally//关闭结果集、数据库等连接rn try rn if(rs != null)rn rs.close();rn System.out.println("rs close");rn catch(SQLException sqlex1)rnSystem.err.println(sqlex1.getMessage());rn rn tryrn if(stmt != null)rn stmt.close();rn System.out.println("stmt close");rn catch(SQLException sqlex2)rn System.err.println(sqlex2.getMessage());rn rn rn connDB.closeConnection();rn return rs;rn rnrnrnrnrn[color=#00FF00] public static void main(String[] args) [/color]statementExp se=new statementExp();rnString sql="select * from tb_gov";rnResultSet rs=null;rn[color=#FF0000]rs=se.executeQuery(sql);/////////////////???????????????????[/color]rntryrnif(rs.next())//对查询结果进行判断rn System.out.println("查询成功"); rnelsernSystem.out.println("查询失败");rnrncatch(Exception e)rnSystem.out.println(e.getMessage());rnrn rnrnrnrnrn在调试到红色这句时,进入executeQuery(String sql)函数里时,逐步调试,显示如下rn变量名 变量值rnconn SQLServerConnectionrnstmt [color=#FF00FF]BaseStatement[/color]rnrs [color=#FF00FF]BaseResultSet[/color]
刚接触AJAX
刚刚接触AJAX做项目,在测试中发现ajax中xmlhttp对象在IE7/8中不能如期实现目标,代码如下:rnrn[code=JScript]rnfunction createXMLHttpRequest()rn rn var request = false;//开始初始化XMLHttpRequest对象rn if(window.XMLHttpRequest) //Mozilla浏览器rn request = new XMLHttpRequest();rn if(request.overrideMimeType) //设置MiME类别rn request.overrideMimeType('text/xml');rn rn else if(window.ActiveXObject) //IE浏览器rn rn var msxmlObj=new Array(rn "MSXML2.XMLHTTP.7.0",rn "MSXML2.XMLHTTP.6.0",rn "MSXML2.XMLHTTP.5.0",rn "MSXML2.XMLHTTP.4.0",rn "MSXML2.XMLHTTP.3.0",rn "MSXML2.XMLHTTP",rn "MSXML3.XMLHTTP",rn "MSXML.XMLHTTP",rn "Microsoft.XMLHTTP");rn rn for(var i=0;i
很简单的问题,求时候段的!非常急!
from_date end_datern----------------------- -------------------rn2007-05-01 00:00:00 2007-06-06 00:00:00rn2007-10-01 00:00:00 2007-10-10 00:00:00rn表的结构如上,rn现在我想写一存储过程,两个参数,一个开始时间,一个结束时间,也就是我想用这个存储过程判断一个时间段是否在这个表里的时间段内,如果在返回1,如果不在返回0,谢谢大家了,
求一查询语句,写了好久都没有成功
表结构如下:rnrnId AlarmCode AlarmContent UnAlarmCode UnAlarmContentrn1 0101 窃电/恢复 0181 窃电恢复 rn2 0102 计量装置门打开/关闭 0182 计量装置门关闭rn3 0103 差动报警 0183 差动恢复rnrn现在想写个查询语句做如下视图:rnrnid AlarmContentrn1 窃电rn2 窃电恢复rn3 计量装置门打开rn4 计量装置门关闭rn5 差动报警rn6 差动恢复rnrn其实也就是把AlarmContent 和UnAlarmContent 两列给组织成一列,同时也要把AlarmContent列中的“/”后的字符给过滤掉。该怎样实现?
写了一个字符串比较的小程序,结果发现无论如何都输出2,为什么?
code segmentrn assume cs:codern org 100hrn db 'hbha$';我改成aaaa,或者kkkk,结果竟然都还是输出"2"rn db 'hche$'rnstart:rn mov si,100hrn mov di,105hrn mov ax,0hrn mov ds,axrn mov es,axrn mov cl,4hrn rep cmpsbrn jl printlrn jg printgrnprinte:rn mov ah,2hrn mov dl,31h;输出1rn int 21hrn jmp returnrnprintl:rn mov ah,2hrn mov dl,32h;输出2rn int 21hrn jmp returnrnprintg:rn mov ah,2hrn mov dl,33h;输出3rn int 21hrnreturn:rn mov ah,4chrn int 21hrncode endsrnend startrnrn----------------------rnrn我的代码到底错在哪里?
趣图:野指针
(给程序员的那些事加星标,每天看趣图)「你居然招惹野指针!」↓↓↓说明:为啥有时候「趣图」栏目是视频?因为:① 微信公号后台对图片大小有限制,最大 2MB;② 有时候 G...
测试蓝本--王振刚
探索我国软件外包产业的发展道路,必须分析国际软件外包的市场特点,发挥我们的技术和市场优势,找准在全球外包服务行业的自身定位,从某一个具有显著优势的外包领域入手,不断打造中国外包服务的品牌。因此,从技术定位角度考虑,虽然软件外包测试的技术含量不太高,但对现阶段的中国软件外包企业却是最适合的,可以在欧美日等全球市场率先实现全面突破。
刚两种查询的测试
刚才我提问的两种查询孰优孰劣的rn[code=SQL]SELECT TOP 1 a.spmch,c.bm,a.lshj,c.shl,b.xingming,b.gukeid,c.rq,c.ontimernFROM dbo.spkfk a,dbo.ret_cuxiaoka_v b,dbo.retmxls crnWHERE a.spid=c.spid AND b.cardid=c.cardid AND b.gukebh ='060600'rnORDER BY c.rq DESC[/code]rnrn这是第一种的执行计划rn[img=http://hi.csdn.net/attachment/201109/2/3590095_1314932708W4j1.jpg][/img]rn[url=http://download.csdn.net/source/3568799]下载地址[/url]rnrnrn[code=SQL]SELECT a.spmch,c.bm,a.lshj,c.shl,b.xingming,b.gukeid,c.rq,c.ontimernFROM dbo.spkfk a,dbo.ret_cuxiaoka_v b,dbo.retmxls crnWHERE a.spid=c.spid AND b.cardid=c.cardid AND b.gukebh ='060600' AND rq>'2011-08-30'rnORDER BY c.rq [/code]rnrn这是第二种的执行计划rn[img=http://hi.csdn.net/attachment/201109/2/3590095_1314932709H7mQ.jpg][/img]rn[url=http://download.csdn.net/source/3568812]下载地址[/url]
44b0的问题:写了下flash,结果板子起不来了
各位:rn 现在遇到这个问题,44b0的板子我刚拿到,上面的flash是AMD29LV160的,看了下它的datasheet,按通用擦写程序对板子来了次擦写。以前用ZLG的LPC2200也操作过sst的flash,没仔细看操作文档,结果这次在AXD里单步擦了一下后还没写进去,程序好像有点问题,我退出来想再进去板子就起不来了。没写之前,上电后串口会打印u-boot信息,LED灯闪一下后全灭掉,可以使用相关命令,一切ok。现在上电什么反应都没了,而且上面几个LED等一直常亮。现在疑问如下:rnrn是不是我把板子的u-boot文件给擦掉了?我擦写的起始地址是0x00500000,ram起始地址是0x0c008000.
测试刚开发的apk
用于登录测试的apk,大家可参考,非常有用。
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法