Can we execute SQL queries in jQuery

can we execute mySQL queries in jQuery Calllback and misc functions. Functions

as a simple request

UPDATE EMPLOYEE SET PAY = PAY + 500 WHERE E_ID = '32'
+3
source share
4 answers

The best you can do is send an AJAX request to the server and then execute that request using the server side code.

In this case, you can use jQuery.post () .

Edit

Get AJAX Review Read this

Read this to get and view AJAX methods in jQuery.

Write server-side logic to execute the SQL command on the page. Then, using AJAX, a request is issued to this page.

Code example

$(function(){
    // Bind a click event to your anchor with id `updateSal`
    $("#updateSal").click(function(){
        // get your employeeID
        var empID = "32"; 
        // issue an AJAX request with HTTP post to your server side page. 
        //Here I used an aspx page in which the update login is written
        $.post("test.aspx", { EmpID: empID},
            function(data){
                // callack function gets executed
                alert("Return data" + data);
        });

        // to prevent the default action
        return false;
    });
});
+9

script, MySQL, .

SQL- -, , - .
, .

+9

javascript/jQuery, - , .

0

:

https://github.com/vinval/MyJSQL

:

$.jsql({
tbName:"EMPLOYEE",
set:["PAY=PAY+500"],
where:"E_ID=32"
}, function(){
//this is the callback 
})
0

Source: https://habr.com/ru/post/1775994/


All Articles