0

i am trying to display the full response of jsonp call in textarea and div but for some reason it doesnt work! could any one tell me what i am doing wrong here?Thanks

ajax script:

<script>


$(function() {

    $.ajax({

        type: "GET",

        dataType: "jsonp",

        cache: false,

        url: "https://api.somesite.com/test&count=-1",


        success: function(data) {

              alert(data);
              $(".response").append(data);
              $("#outputtext").append(data);


             document.myform.outputtext.value = document.myform.outputtext.value+data+'\n' ;



        }

    });

});


</script>

<div class="response"></div>

<form id="myform" name="myform" action="./" method="post">

<td><textarea rows="6" cols="15" name="outputtext" style="width: 99%;"></textarea></td>

</form>
user1788736
  • 2,727
  • 20
  • 66
  • 110
  • try with $("textarea[name='outputtext']").val(response); whether data returns something ? Read this: http://stackoverflow.com/questions/6809053/simple-jquery-php-and-jsonp-example – vuz3 Jun 07 '14 at 15:54
  • thanks for response . i get [object Object] in the textarea – user1788736 Jun 07 '14 at 16:04
  • You get whole object not a one data, example to use: response.foo – vuz3 Jun 07 '14 at 16:08

0 Answers0