javascript - how to read html data from another page using ajax -
this url "users/1/providers/1/check" page containing following html
<select id="document1" class="form-control"> <option th:value="0" >select document want share</option> <option th:each="document : ${documents}" th:value="${document.id}" th:text="${document.name}">[name]</option> </select>
on url "/users/1/providers/1/documents/1/consents/new: want access data in html "users/1/providers/1/check"
<select id="provider" name="provider" class="form-control" th:onchange="'javascript:showpiidoc(this.value);'"> <option th:value="0" >select service provider</option> <option th:each="provider : ${user.providers}" name="name" th:value="${user.id} +','+ ${provider.id}" th:text="${provider.name}" >[name]</option> </select>
using ajax how it. using spring mvc
function showpiidoc(doc) { var split = doc.split(","); var userid = split[0]; var providerid = split[1]; $.ajax({ url: '/users/'+ userid +'/providers/' + providerid + '/check', success: function(html){ //create jquery object response html. var $response=$(data); //query jquery object values var oneval = $response.filter('#document1').text(); alert(oneval); } }); }); }
please guide me
Comments
Post a Comment