简体   繁体   中英

how to refer an external link from wordpress page

I have created button and a text field in my wordpress page and when user add something and clicked search it will go to an external link to search.i tried this and my html and javescript as follows the thing is if i need to add a link like this https://the outside site/index.php?NAME_PATH=DOMAINS_PATH it will redirected in wordpress as this http://server/mywordpressfolder/?domainname=dyhrrty&name=.com so gives an 404 error how to resolve this!


  
 
  
  
  
 
    function callGetDomain() 
    { 
        var res1=$("#domainname").val();
        var res2=$("#name").val();
        var name=res1+res2; if(res1!="Domain Name")  {           
        location.href="https://www.google.lk/search?q=test"; }
        else { alert("Please Specify Domain Name"); }
    } 
 
<div class="search_domaim">
<div class="title_text">
 <h2>Register This Domain</h2></div>
<div class="search_field">
<form action="" method="get">
<div class="search_input">
<input name="domainname" type="text" class="textbox" id="domainname" onfocus="if (value == 'Domain Name') {value =''}" onblur="if (value == '') {value = 'Domain Name'}" value="Domain Name"></div>
<div class="search_drop">
<select name="name" id="name">
 <option value=".com">.com</option>
 <option value=".in">.in</option>
</select>
</div>
<div class="search_btn">
<!--<input name="" type="image" src="images/domain_search_btn.png" />-->
<input type="submit" value="Search" class="domain_submit" onclick="callGetDomain();">
</div>
<div class="clear"></div>
</form>
</div>
<div class="clear"></div>
</div>

it will run in normal way but in wordpress how to achieve this????

I have done using onCick method

Heres my Fiddle

$(".domain_submit").on("click",function(){

     var res1=$("#domainname").val();
    var res2=$("#name").val(); 
    var name=res1+res2; alert(name);
    if(res1!="Domain Name") { window.open('https://www.google.lk/search?q=test','_blank'); }
    else { alert("Please Specify Domain Name");
         }

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM