weixin_33675507 2016-05-19 19:04 采纳率: 0%
浏览 37

为什么Ajax刷新我的页面?

My code

function getQuote(){
$.ajax({
    headers: {

        "X-Mashape-Key": "......",
        "Content-Type": "application/x-www-form-urlencoded",
        Accept: "application/json"
    },
    url: 'https://andruxnet-random-famous-quotes.p.mashape.com/?cat=movies',
    success: function(response) {
        var r = JSON.parse(response);
        currentQuote = r.quote;
        currentAuthor = r.author;
}

There might be some syntax error above but that's because of editing the code here. So there's no syntax error in my original code.

I simply want to change the content of the quote text and writer when the button is clicked without the page being refreshed.

  • 写回答

0条回答 默认 最新

    报告相同问题?