title: Pass javascript variable in twig to php controller on button click
body: <p>I have Google maps and a rectangle highlighting some area on top of the map. NorthEast and Southwest latitudes of that rectangle are stored as javascript variables(ne,sw).I want to send those parameters to a php controller on button click, like this:</p>
  
  <p>View</p>
  
  <p>How can I do that? I d'ont have knowledge of AJAX nor JQuery.</p>
  
  <pre><code>{% extends 'base.html.twig' %}
  
  {% block body %}
  
  var ne;
  var sw;
  
  &lt;a href="/highlighted/{{something}}" class="btn btn-success"&gt;View&lt;/a&gt;
  &lt;div id="map" style="width:100%;height:500px"&gt;&lt;/div&gt;
  
  
  &lt;script language="javascript" type="text/javascript"&gt;
  function myMap() {
  map = new google.maps.Map(document.getElementById('map'), {          center: {lat: 6.911918, lng: 79.892780},
      zoom: 9
    });
  
    var bounds = {
      north: 7.011918,
      south: 6.811918,
      east:  79.992780,
      west:  79.792780
    };
  
    // Define the rectangle and set its editable property to true.
    rectangle = new google.maps.Rectangle({
      bounds: bounds,
      editable: true,
      draggable: true
    });
  
    rectangle.setMap(map);
    // Add an event listener on the rectangle.
    rectangle.addListener('bounds_changed', showNewRect);
  
    // Define an info window on the map.
    infoWindow = new google.maps.InfoWindow();
  }
  
  // Show the new coordinates for the rectangle in an info window.
  
  /** @this {google.maps.Rectangle} */
  function showNewRect(event) {
    var ne = rectangle.getBounds().getNorthEast();
    var sw = rectangle.getBounds().getSouthWest();
  
    map.northLatitude=2.33;
  
    var contentString = '&lt;b&gt;Rectangle moved.&lt;/b&gt;&lt;br&gt;' +
        'New north-east corner: ' + ne.lat() + ', ' + ne.lng() + '&lt;br&gt;' +
        'New south-west corner: ' + sw.lat() + ', ' + sw.lng();
  
    // Set the info window's content and position.
    infoWindow.setContent(contentString);
    infoWindow.setPosition(ne);
  
    infoWindow.open(map);
  
      //window.location.href = "Controller/SatelliteImages_Controller.php?w1=" + ne + "&amp;w2=" + sw;
      return (ne+sw);
  }
  
  &lt;/script&gt;
  
  &lt;script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyALi1Ro_johRtFp2JrLa9zGMLTwBMxBrHQ&amp;callback=myMap"&gt;&lt;/script&gt;
  
  {% endblock %}
  </code></pre>
  
  <p>Please excuse my bad syntax. I'm new to PHP and Symfony.</p>