0

I'm looking to make a database connection test with AJAX, I want the user to fill in their database information, and then have a test button that takes the $_GET variables filled out so far, process those $_GET variables in a database connection test script, and then return success or fail. My question is, how would I pass the $_GET variables filled out so far, without reloading the page?

Thanks for any help - Necro.

4
  • Yep, you're gonna use ajax like you said. Is there something specific you'd like us to help you with? Commented Nov 9, 2012 at 16:05
  • 1
    Your users need a lesson in security ;p Commented Nov 9, 2012 at 16:07
  • @LawrenceCherone Sorry, I should be using POST, I know. When I was typing up the question I just typed GET. It was the first thing that popped into my head. Commented Nov 9, 2012 at 17:30
  • @Necro I meant passing there server details to a 3rd party, without saying you would but there is nothing stopping you from storing. Also you should be wary of a curl script brute forcing, essentially your just creating a proxy open to abuse. Commented Nov 9, 2012 at 17:32

2 Answers 2

2

you need to use the ajax with either javascript or jquery

like with jquery

$.ajax({
    type: "GET",
    url: "serverside script to process on data",
    data:{name:youwant}, //name is a $_GET variable name here,
                           // and 'youwant' is its value to be passed 
    success: function(data){
         alert("return here if success")

    }
})
Sign up to request clarification or add additional context in comments.

2 Comments

name is a $_GET variable name here, and 'youwant' is its value to be passed
youwant undefined variable though here. Put quotes around to be a string. (if that's what you intended)
1

you can try jquery.ajax() - method like this..

$.ajax({
  url: 'server_script?para_name='+para_value,
  success: function(data) {
  $('.result').html(data);
     alert('Load was performed.');
  }
});

OR you can use jquery-ajax method like

 $.get("script", { para_name:"para_value", para_name:"para_value"});

For more info visit..w3schools

3 Comments

i really appreciate your answer but pls dont suggest w3schools
Same as above, I appreciate the above answer, they both work, but the below explains it to me much better.
@NullPointer : ok you can visit jquery official site :) api.jquery.com/jQuery.ajax

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.