I am trying to write a code that receives value from the database and slidetoggle ()
This database is a .html file without recovery, which works perfectly:
& lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" src = "c: \ user \ captive desktop \ jquery-1.9.1.min.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body onload = "handleChange ();" & Gt; & Lt; Label & gt; & Lt; Input type = 'checkbox' onchange = 'handleChange ();' & Gt; Check box & lt; / Label & gt; & Lt; Script & gt; Change the Function Handle () {$ ('. Slide Togglebox'). Slide Toggle (); } & Lt; / Script & gt; & Lt; Div class = "slideTogglebox" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; Input type = "checkbox" & gt; Judge 1 & lt; / Li & gt; & Lt; Li & gt; & Lt; Input type = "checkbox" & gt; Judge 2 & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; Then I wrote a .jsp file above the jQuery with database recovery, but in output it is showing only the retrieved values, but slidetoggle () The function is not working
& lt;% @ page content type = "text / html; charset = iso-8859-1" language = "Java" import = "Java SQL. *" Error page = ""%> & Lt; Html & gt; & Lt; Top & gt; & Lt; Script language = "javascript" type = "text / javascript" src = "c: \ user \ captive desktop \ jquery-1.9.1.min.js" & gt; & Lt; / Script & gt; & Lt; Script language = "javascript" & gt; Change the Function Handle () {$ ('. Slide Togglebox'). Slide Toggle (); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body onload = "handleChange ();" & Gt; Try & lt;% {Connection Conn = Null; Reset the result; Class.forName ("com.mysql.jdbc.Driver"); Con = DriverManager.getConnection ("JDBC: mysql: // local host: 3306 / unicet", "root", ""); String strsql = null; Strsql = "Choose from projects" *; Statement stmt = conn.createStatement (); Rs = stmt.executeQuery (strsql); While (rsnext ()) {%> & Lt; Br> Input type = 'checkbox' onchange = 'handleChange ();' & Gt; & Lt;% out.print ("CO" + rs.getInt (1) + ""); Out.print (rs.getString (2)); }} Hold (exception e) {e.printStackTrace (); Println (E); }% & Gt; & Lt; Div class = "slideTogglebox" & gt; & Lt;% Connection Conn1 = Faucet; Results set rs1; Conn1 = DriverManager.getConnection ("JDBC: mysql: // local host: 3306 / aniket", "root", ""); String strsql1 = faucet; Strsql1 = "Choose from Judges *" *; Statement stmt = conn1.createStatement (); RS1 = stmt.executeQuery (strsql1); While (rs1.next ()) {%> gt; & Lt; Br> Input type = 'checkbox' & gt; & Lt;% out.print (rs1.getInt (1)); Out.print (rs1.getString (2)); }% & Gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; You should use a URL in a jQuery script file, a full file system path is not . Ideally, this would be something like this
Where jQuery script is part of your app.
If you want to run it only on your local machine, you can stay with the filesystem path but should use it.
& lt; Script src = "file: /// c: / user / fascinated / desktop / jquery-1.9.1.min.js" & gt; & Lt; / Script & gt; A better solution is to use, e.g.
& lt; Script src = "// ajax.googleapis.com/ajax/libs/JQuery/1.9.1/jquery.min.js" & gt; & Lt; / Script & gt;
One more thing, you really should add a methodology to the top of your document. I'm HTML5
No comments:
Post a Comment