ドロップダウンの選択に変更があるたびに、コードをロードしようとしています。これを行う最善の方法は、ファイルを .load することだと思いましたが、それでは asp/sql がうまくいかないようです。
次のコードを機能させるにはどうすればよいですか。
$(document).ready(function() {
$("#abn").change(function () {
$("#searchUpdate").load("sql.asp");
})
.change();
});
エラー:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/junk/dbinstant.htm, line 27
ページコード:
<%@ LANGUAGE="VBSCRIPT" %>
<%
pagetitle="Contractor Details"
%>
<!--#INCLUDE VIRTUAL="/_lib/include/header.htm"-->
<!--#INCLUDE VIRTUAL="/_lib/include/menu.htm"-->
<script>
$(document).ready(function() {
$("#abn").change(function () {
$("#searchUpdate").load("sql.asp");
})
});
</script>
<div class="twoColumnRow">
<div class="twoColumnContent">
<p class="breadCrm"><a href="/index.htm">Home</a> <span>></span> <a href="/tools/index.htm">Tools of the Trade</a> <span>></span> <a href="/tools/finance/index.htm">Finance and Purchasing</a><span>></span> <a href="/tools/finance/procurement/index.htm">Procurement and Contracts information</a></p>
<div class="contentPad">
<!-- Start of main content -->
<p class="imageRight"> </p>
<h1><%=pagetitle%></h1>
<div id="searchUpdate"></div>
<h2>Search results</h2><hr />
<% if not con.BOF then %>
<div style="margin-top:1em">
<form action="dbresults.htm" method="get">
<p>Company name:<br/>
<select id="abn" name="abn">
<option label="All companies" value="all"></option>
<% while (NOT scon.EOF) %>
<option label="<%=scon("legal")%>" value="<%=scon("abn")%>"></option>
<%scon.MoveNext()
Wend %>
</select>
</p>
<p>Categories for Creative Design:<br/>
<select id="cat" name="cat">
<option class="group" label="All categories" value="all"></option>
<option class="group" label="Strategic brand, marketing and communications advice" value="a"></option>
<option class="group" label="Graphic design and layout" value="b"></option>
<option class="group" label="Forms design" value="c"></option>
<option class="group" label="Web design and development" value="d"></option>
<option class="group" label="Authoring services" value="e"></option>
<option class="group" label="Editorial services" value="f"></option>
<option class="group" label="Translation services" value="g"></option>
<option class="group" label="Photography and film services" value="h"></option>
<option class="group" label="Scanning and digitisation services" value="i"></option>
<option class="group" label="Multimedia editing services" value="j"></option>
</select>
</p>
<input type="submit" value="Search" />
</form>
<br /><hr />
<table style="font-size:.9em;" class="contentTable">
<tr>
<th>ABN:</th>
<th>Company Name:</td>
</tr>
<% con.Movefirst() %>
<% while (NOT con.EOF) %>
<tr>
<td><%=con("abn")%></th>
<td><a href="dbcomp.htm?abn=<%=con("abn")%>&cat=all"><%=con("legal")%></a></td>
</tr>
<%
con.MoveNext()
Wend
%>
</table>
</div>
<% else %>
<% scon.Movefirst() %>
<form action="dbresults.htm" method="get">
<p>Company name:<br/>
<select name="abn">
<option label="All companies" value="all"></option>
<% while (NOT scon.EOF) %>
<option label="<%=scon("legal")%>" value="<%=scon("abn")%>"></option>
<%scon.MoveNext()
Wend %>
</select>
</p>
<p>Categories for Creative Design:<br/>
<select name="cat">
<option label="All categories" value="all"></option>
<option label="Strategic brand, marketing and communications advice" value="a"></option>
<option label="Graphic design and layout" value="b"></option>
<option label="Forms design" value="c"></option>
<option label="Web design and development" value="d"></option>
<option label="Authoring services" value="e"></option>
<option label="Editorial services" value="f"></option>
<option label="Translation services" value="g"></option>
<option label="Photography and film services" value="h"></option>
<option label="Scanning and digitisation services" value="i"></option>
<option label="Multimedia editing services" value="j"></option>
</select>
</p>
<input type="submit" value="Search" />
</form>
<br /><hr />
<p>No records match your query.</p>
<p><a href="dbtest.htm">Return to search page</a></p>
<%
end if
con.close
%>
<!-- End of main content -->
</div> <!-- end contentPad div -->
</div> <!-- end twocolumncontent div -->
<div class="twoColumnLinks">
<!--<div class="relatedLinks">
<h3>Related Links</h3>
<ul>
<li><a href="/index.htm">Related link 1</a></li>
</ul>
</div>--> <!-- end relatedlinks div -->
<!--#INCLUDE VIRTUAL="/_lib/include/quicklinks.htm"-->
<!--#INCLUDE VIRTUAL="/_lib/include/mylinks.htm"-->
</div> <!-- end twocolumnlinks div -->
</div> <!-- end twocolumnrow div -->
<!--#INCLUDE VIRTUAL="/_lib/include/footer.htm"-->
ASP ページ コード:
<%
Dim connectString, connect, conDB, sconDB, con, scon, src_abn, src_cat
connectString = "Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=" & Server.MapPath("data")
src_abn = Request.QueryString("abn")
src_cat = Request.QueryString("cat")
set connect = Server.CreateObject("ADODB.connection")
connect.open connectString
if src_abn = "all" and src_cat = "all" then
conDB = "SELECT * FROM cont.csv"
elseif src_abn = "all" then
conDB = "SELECT * FROM cont.csv WHERE " & src_cat & " = 'Yes'"
elseif src_cat = "all" then
conDB = "SELECT * FROM cont.csv WHERE ucase(abn) LIKE ucase('%"+src_abn+"%')"
else
conDB = " SELECT * FROM cont.csv WHERE " & src_cat & " = 'Yes' AND ucase(abn) LIKE ucase('%"+src_abn+"%')"
end if
sconDB = "SELECT * FROM cont.csv"
set con = connect.execute(conDB)
set scon = connect.execute(sconDB)
%>