Jump to content
tea

inside Ajax success

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);

          }
      });
        };

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...