Jump to content

inside Ajax success


tea

Recommended Posts

Hi... I am inside Ajax success function... here is my code... I have accessed the client server url successfully, but also I have to execuet the query that i have to get the result inside the Ajax function to post in my jsp page..... can someone please assist on how we can acheive this?

function Call() {
              var query='select * from employees';
            var querystring = "joinType=3&userLocale=English&query="+query&maxrow="2;
      $.ajax({
          url:'https://testurl',
          type:'POST',
          success: function(data, url, jqhxr)
          {


               $('#div').html(this.url);
              console.log('Am here nowww',this.url);

          }
      });
        };

Link to comment
Share on other sites

You don't execute the query in Javascript in the browser, database queries are executed on the server.  You should send any data that needs to be part of the query to the server, execute the query there, and return the query result back to the browser.  It's also a terrible idea to send the actual SQL query from the browser to the server, that's a fantastic way to get your site hacked.  Send only the data that needs to be part of the query, and on the server use a prepared statement to add the data to the SQL query and send it to the database.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...