javascript - Trying to get an ASP.NET search thingy to work on my site -
javascript - Trying to get an ASP.NET search thingy to work on my site -
i'm working on project involves using header organization's website on website. there's search feature which, if possible, need work on site (although should trigger search on org's website. is, if type "blah blah" input , click enter, should open http://www.organization_website.org/home/search-results.aspx?search=blah+blah). since know nothing asp.net, can someone, first of all, tell me whether i'm trying possible?
i'm trying backtrack see need include in code work. when hover house on search icon, shows javascript:__dopostback('dnn$dnnsearch$cmdsearch',''). searched function dopostback(...)
, found it:
var theform = document.forms['form']; if (!theform) { theform = document.form; } function __dopostback(eventtarget, eventargument) { if (!theform.onsubmit || (theform.onsubmit() != false)) { theform.__eventtarget.value = eventtarget; theform.__eventargument.value = eventargument; theform.submit(); } }
in other words, searching takes form
either id
or name
equal form, sets value of few of input
s , submits it. reason action of the form set page ....
<form method="post" action="/thispage.aspx" id="form" enctype="multipart/form-data">
i don't understand that. anyways, i'm pretty much lost.
if right can trough jquery
$(document).ready(function (){ $('#searchbtn').click(function (e){ window.location = 'http://www.organization_website.org/home/search-results.aspx?search=' + $('#searchbox').val(); //it recirect url above search box content appended }); });
or trough server side code within button click event in vb code
response.redirect("http://www.organization_website.org/home/search-results.aspx?search=" & searchbox.text)
javascript asp.net forms
Comments
Post a Comment