1

I need to pass the parameters to URL.I have posed the code.

How can I pass the username and password entered in the textbox to URL in my code.thanks for any help..

1
  • it's not java script. It's javascript. Commented Oct 9, 2012 at 6:13

4 Answers 4

1

You should not send password in the URL.

If you want to pass some other details: Update these two lines as below:

             data: {data1:$("input#data1").val(),data2:$("input#data2").val()},
             url: "http://localhost:53179/hdfcmobile/hdfc.ashx",
Sign up to request clarification or add additional context in comments.

1 Comment

You mean type. if yes, you have already written it -- type: 'POST',
0

if you want to pass a url parameter, the you want to use:

type: 'GET'

and also:

url: 'http://localhost:53179/hdfcmobile/hdfc.ashx

into the .ajax configs, using type:'POST' will post the fields into the headers instead of the url.

Comments

0

Try below code:

You can try your code in this pattern...

var sdate = $('#banners_startdate').val();

var edate = $('#banners_enddate').val();

        if(sdate != '' && edate != ''){
            $.ajax({
                url: 'your url',
                data: 'apiname=get_banner_stat_platform_sharing&var=bannerstats&sdate=' + sdate + '&edate=' + edate,
                dataType: 'html',
                success: function(data){ 
                                         $('#bannerstats').html(data);
                                          return false;
                                       }
            });
        }

Comments

0

Where username and password can be fetch by id:

function ajaxcall(username,password)
   {
         jQuery.ajax({

                      type: "POST",

                      url: "Enter Url to pass",

                      data: {user: username, pass: password},

                      dataType: "html",

                      success: function(data) {
                          //write code what you want to do here
                      }

         });

   }

You can fetch the value on page by just $_POST['user'] and $_POST['pass'].

Comments

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.