sarthaksss
sarthaksss

Reputation: 127

How to use PHP in Javascript

This is the jquery that i'm using.

I need to use 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?

Upvotes: 1

Views: 102

Answers (2)

jon3laze
jon3laze

Reputation: 3196

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.

Upvotes: 4

Jim
Jim

Reputation: 73936

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.

Upvotes: 3

Related Questions