How to make a jsonp call to an api using jquery

前端 未结 3 1523
梦如初夏
梦如初夏 2021-01-13 15:27

I am new to programming in general and i am having trouble getting the data into my web app when i make a call to the moviedb.org api. I am using jquery and i have read all

3条回答
  •  囚心锁ツ
    2021-01-13 15:59

    First of all you have to make sure the api your calling supports jsonp (if it doesn't you will see the json but you won't be able to do anything with it).

    Second. If you don't add a callback name so you leave the ?callback=? then jquery will add a random number to the end of your url and will most likely cause a problem. It would look like this:

    http://someurl.com?callback=140989239
    

    That only hurts you. In standard jsonp you actually insert the json into a

提交回复
热议问题