如何在js追加后运行php函数

时间:2016-12-24 16:31:04

标签: javascript php

我从我的.js文件中添加一个值,如此

        elemscore.append("You Scored: " + score);

然后我需要根据分数访问数据库记录。如何在追加

之后实现这一目标

1 个答案:

答案 0 :(得分:0)

您可以执行类似这样的ajax请求。

var url = 'http://localhost/phalcon3/blog?month='+pmonth+'&

$.ajax({
    type:"POST",
    url: url
    data: {postVar1:"value",postVar2:"second value"},

    success: function(result){
        // either do something with whats returned or call another jquery function
        console.log(result);
    },
    error: function(){
         // error reporting/handling
    }
});
相关问题