I'm using JSONP with code:
<script>
$.ajax({
url:"http://localhost:8080/pool/main/?pool=abcd",
dataType: 'JSONP',
success:function(response){
$('#pool').append(response);
},
error:function(){
alert("ERROR");
},
});
</script>
I have to user JSONP, becouse i need ajax cross domain
In my application response from "http://localhost:8080/pool/main/?pool=abcd
" is HTML code.
I wanted to display this code in my page, but there is an error, because as i assume, i can't return html.
ERROR - i mean - it produce me this code error:function(){
alert("ERROR");
}
, but i see in firebug that the response from my page http://localhost:8080/pool/main/?pool=abcd
is ok. But secoundly. i don't know how to put the response to html element.
My question is - CAN I or I CAN'T.
If i can - how to do this ?
If you want to use JSONP, you need to generate a piece of scripts calling a method with returned data. If you want to get a piece of HTML, your url should output code like this:
callFunction("<div>abc</div>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With