简体   繁体   中英

Manipulate DOM on Response from Server

I have a HTML page that sends a query and gets the response from a server using JQuery's POST ($.post().done())

<!doctype html>
<html>
<head>
    <script src="jquery-1.11.2.min.js"></script>
</head>
<body>

<center>
    <div>
    <h3>Web Service Search Engine </h3>
    <input type="textbox" name="UserQuery" id="UserQuery" size="70"></br></br>
    <button type="button" onclick="search()">Search</button>
    </div>
</center>
<div id="Results">
</div>
<script>
function search()
{
    $.post("Check.php", {
        UserQuery:  $("#UserQuery").val()

    })
  .done(function(data) {

    })
}
</script>

</body>
</html>

The response from Check.php is a few links which are already formatted

<a href="Crawled WSDL Documents/21272_United_States_shortlynx.wsdl">Crawled WSDL Documents/21272_United_States_shortlynx.wsdl</a><br/>
<a href="Crawled WSDL Documents/16932_United_States_dailycomicsservice.wsdl">Crawled WSDL Documents/16932_United_States_dailycomicsservice.wsdl</a><br/>
<a href="Crawled WSDL Documents/15465_United_States_measurementconversions.wsdl">Crawled WSDL Documents/15465_United_States_measurementconversions.wsdl</a><br/>
<a href="Crawled WSDL Documents/14242_United_States_converter.wsdl">Crawled WSDL Documents/14242_United_States_converter.wsdl</a><br/>
<a href="Crawled WSDL Documents/17606_Spain_conversor.wsdl">Crawled WSDL Documents/17606_Spain_conversor.wsdl</a><br/>

How do I put this response inside the DIV tag with the id = Results ??

I'm not trying to scam the commentor. I am just giving it as an answer

$("#Results").html(data);

Credits to Brijesh Bhatt

This would work

...

.done(function(data) {
  $('#Results').html(data);
})

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