jQuery.ajax() parsererror

前端 未结 3 2052
时光说笑
时光说笑 2020-12-05 03:35

when i try to get JSON from http://api-v3.deezer.com/1.0/search/album/?q=beethoven&index=2&nb_items=2&output=json with:

(jQuery 1.6.2)

$.ajax({
         


        
3条回答
  •  日久生厌
    2020-12-05 03:36

    in case the server does not support the cross domain request you can:

    1. create a server side proxy
    2. do ajax request to your proxy which in turn will get json from the service, and
    3. return the response and then you can manipulate it ...

    in php you can do it like this

    proxy.php contains the following code

    
    

    and you do the ajax request to you proxy like this

    
    
    

    tried and tested i get the json response back...

提交回复
热议问题