I have this script that I've used with PHP and it works, but I'm moving 
everything from PHP to Web2PY easy to deploy to coworkers.

PHP page (I left out the PHP part of the code that makes a REST API call to 
an appliance)

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Get Current Running Config</title>
    <script 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";></script>
</head>
<body>
<h2>Get Current Running Config</h2>
Choose a Device Name<br>
<select name="selectFrequency" id="selectFrequency">
  <option value="">- Select -</option>
<?php foreach ($json_a['devices'] as $devname)
{
 echo "<option value=". $devname['DeviceID'].">". $devname['DeviceName'] 
."</option>";

} ?>
</select>
<div id="resultip"></div>
<script>
$(document).ready(function(){
$("#selectFrequency").change(function() {
    var selected = $(this).val();
    $.ajax({
        url: "get.php", 
        type: "GET", 
        data: {id : selected},
        success: function(data) {
          $('#resultip').html(data);
        }
    });
});
});
</script>
</body>
</html>

Here is my view page:
Enter code here...<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Get Current Running Config</title>
    <script 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";></script>
</head>
<body>
<h2>Get Current Running Config</h2>
Choose a Device Name<br>
<select name="selectFrequency" id="selectFrequency">
    <option value="">- Select -</option>
{{for tmp_name,tmp_id in zip(names,id):}}
    <option value="{{=tmp_id}}">{{=tmp_name}}</option>";
{{pass}}
</select>
<div id="resultip"></div>
<script>
$(document).ready(function(){
$("#selectFrequency").change(function() {
    var selected = $(this).val();
    $.ajax({
        url: "get_config_details",
        type: "GET",
        data: {id : selected},
        success: function(data) {
          $('#resultip').html(data);
        }
    });
});
});
</script>
</body>
</html>


I get the drop down populated correctly with all the device names.
But when I select a device name it calls get_config_details with ?id=43  I 
changed it using the inspect element in the browser to 
get_config_details/43 still nothing shows up on the page.
Any advice or am I approaching this incorrectly

Thanks in advance
Sif

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to