Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are my POST variables showing up on URL string?

I've implemented an ajax post function based on a button click. The code is

$.ajax({
    type: "POST",
    url: "includes/phpscripts?action=manage",
    data: {location: loc, lat: latitude, lon: longitude, heading: head, filename: file},
    success: function(){
      $("#panoInfo").html("<div id='message'></div>");
      $("#message").html("Valid Submission");
  }
});

I specified the POST method since I don't want the variables to be visible via the URL. However, they are.

My test URL before posting is

http://localhost/JMCTour/buildtour.php

Afterwards

http://localhost/JMCTour/buildtour.php?filename=1-prefix_blended_fused.jpg&location=Start+of+Tour&lat=43.682211&long=-70.450705&heading=100&submit=Save

Why?

like image 535
Jason Avatar asked Jun 06 '12 19:06

Jason


1 Answers

Make sure your form tag has method='POST'

<form method='POST'>
...
</form>
like image 187
Arbind Thakur Avatar answered Sep 24 '22 00:09

Arbind Thakur