开发者

Using YUI3 how do I update a record in Mysql?

开发者 https://www.devze.com 2023-03-19 00:06 出处:网络
I have built a drag and drop interface which reads the list from a mysql dB. Now how can I save the "sort order" back to an id? I have a PHP function that will do the saving but I am a notic

I have built a drag and drop interface which reads the list from a mysql dB. Now how can I save the "sort order" back to an id? I have a PHP function that will do the saving but I am a notice with YUI and need a Javascript function to call this PHP function to update a record.

This is what I copied to build the drag and drop. http://developer.yahoo.com/yui/3/examples/dd/list-drag.html

Any help is appre开发者_高级运维ciated.


In order to update a record, what you need to do is making an ajax xmlHtppRequest so that it can make an HTTP POST request and have the data be passed into your server side language. In the end, your server side language will update the record by adding that data into your existing record..it will be something in this form:

YUI().use("io-base", function(Y) {
    var cfg, request, uri; 
        uri = "ssPage.php" //The PHP page in which you pass the data to 

    cfg = {
        method: 'POST',  //you want a POST transaction
            data: 'user=yahoo',  //your data
        arguments: { 'foo' : 'bar' }
    };

    request = Y.io(uri, cfg);
})

I am not that familiar with YUI3, and all I can say is read the documentation of YUI3:IO from yahoo since it will help a lot. Hope that helps.

0

精彩评论

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