Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
129
rated 0 times [  130] [ 1]  / answers: 1 / hits: 21165  / 11 Years ago, wed, december 18, 2013, 12:00:00

I want to call a servlet in JavaScript, but how to call I do not know.



function func_search()
{
var srchdata = document.getElementById('searchitem').value;

if(srchdata == )
{
alert(Enter Search Criteria...);
}
else
{
//what to write here to call servlet ??
}
}

<a onclick=func_search();><img src=images/srch.png height=32px width=32px/></a>

More From » java

 Answers
2

document.location.href is used



function func_search()
{
var srchdata = document.getElementById('searchitem').value;
//alert(srchdata);
if(srchdata == )
{
alert(Enter Search Criteria...);
}
else
{
document.location.href=your servlet name here;
}
}

[#73678] Tuesday, December 17, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cruzs

Total Points: 710
Total Questions: 113
Total Answers: 100

Location: Nepal
Member since Sat, Jul 18, 2020
4 Years ago
cruzs questions
Thu, Nov 26, 20, 00:00, 4 Years ago
Wed, Oct 28, 20, 00:00, 4 Years ago
Wed, Aug 19, 20, 00:00, 4 Years ago
Sun, Aug 2, 20, 00:00, 4 Years ago
;