开发者

How to use PHP in Javascript

This is the jquery that i'm using.

I need to us开发者_StackOverflow中文版e the returned data and store it in a db usin php.

'onComplete'  : function(event, ID, fileObj, response, data) {

      alert('Your video has been uploaded. Thanks.');

Now inside this, i want to use the retuned fileOBJ and store it. How do i do that?


You could place an AJAX call inside of the function that submits the data to the php page.

'onComplete'  : function(event, ID, fileObj, response, data) {

  alert('Your video has been uploaded. Thanks.');

    $.ajax({
        type: 'POST',
        url: 'your_php_page.php',
        data: fileOBJ,
        success: function(msg) {
           //do something
        },
        error: function(msg) {
           //handle error
        }
    });
}

Then you'd simply create a php page that would submit the posted data to your database.

Read more about the $.ajax() call here.


This technique is usually referred to as "Ajax" these days. The scope of your question is too broad to answer here, I recommend you do some reading on it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜