javascript - Get HTML instead of text using YQL Web Service URLs -


how html instead of text using yql?

my code :

<div id="container" style="width:500px;height:500px;">  </div>  jquery.ajax = (function (_ajax) {          var protocol = location.protocol,             hostname = location.hostname,             exregex = regexp(protocol + '//' + hostname),             yql = 'http' + (/^https/.test(protocol) ? 's' : '') + '://query.yahooapis.com/v1/public/yql?callback=?',             query = 'select * html url="{url}" , xpath="*"';          function isexternal(url) {             return !exregex.test(url) && /:\/\//.test(url);         }          return function (o) {              var url = o.url;              if (/get/i.test(o.type) && !/json/i.test(o.datatype) && isexternal(url)) {                  // manipulate options jsonp-x request made yql                  o.url = yql;                 o.datatype = 'json';                  o.data = {                     q: query.replace(                         '{url}',                         url + (o.data ?                             (/\?/.test(url) ? '&' : '?') + jquery.param(o.data)                         : '')                     ),                     format: 'xml'                 };                  // since it's jsonp request                 // complete === success                 if (!o.success && o.complete) {                     o.success = o.complete;                     delete o.complete;                 }                  o.success = (function (_success) {                     return function (data) {                          if (_success) {                             // fake xhr callback.                             _success.call(this, {                                 responsetext: (data.results[0] || '')                                     // yql screws <script>s                                     // rid of them                                     .replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')                             }, 'success');                         }                      };                 })(o.success);              }              return _ajax.apply(this, arguments);          };      })(jquery.ajax);     $.ajax({         url: 'http://www.tala.ir/webservice/price_live.php?host=1',         type: 'get',         success: function (res) {             //alert(res.responsetext);             var content = $(res.responsetext).text();             $('#container').html(content);         }     }); 

it doesn't work in code snippet, works in local testing, fills #container div text (removes html tags).

is there way html code instead of text?

you can full html of page using this

check this

but there know how specific element of page using yql


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -