At the risk of displaying my lack of understanding
about most things..
I need some help.
I'd really like to use the data that available
through the api. But obviously my code skills are letting me down.
Previously when stumped. I've searched the net and
always found examples or tutorials and been able to overcome whatever was in my
way.
However with the open australia api I have had no
luck at all.
Can someone help me with some examples
please?
I will show you what I have so far...
-------------------------------------
Contents of test.php
<html>
<head>
<title>Open
Australia API test - (Under Construction)</title>
<style
type="text/css">
#box { background-color:#FFFF99; border:thin
solid #FF0000; width:70%; height:50px;}
</style>
<script type="text/javascript" src="firebug.js"></script>
<script language="javascript" src="jquery-1.3.2.min.js"></script>
<script language="javascript">
$(document).ready(function() { //Finish loading the entire page before
processing any javascript
$("#subBut").click(function(event) {
var formContent = $("#form1").serialize();
$("#box").load('myserv.php',formContent);
});
});
</script>
</head>
<body>
<form
name="form1" id="form1" method="post" action="">
<label>Main
Function<br><br>
<input type="radio" name="function"
value="getDivisions" />
Electoral Division<br />
<input type="radio" name="function" value="getRepresentative"
/>
MP Details (Id # Required)<br />
<input
type="radio" name="function" value="getRepresentatives" />
MPs
Details<br />
<input type="radio" name="function"
value="getSenator" />
Senator Details (Id # Required)<br
/>
<input type="radio" name="function" value="getSenators"
/>
Senators Details<br />
<input type="radio"
name="function" value="getDebates" />
Debates<br />
<input type="radio" name="function" value="getHansard"
/>
Hansard<br />
<input type="radio"
name="function" value="getComments" />
Comments<br
/><br>
</label>
<label>Output
Type<br><br>
<input type="radio" name="output_type"
value="xml" /> XML<br>
<input type="radio"
name="output_type" value="js" /> JavaScript<br>
<input
type="radio" name="output_type" value="php" /> PHP<br>
<input type="radio" name="output_type" value="rabx" />
RABX<br><br>
</label>
<label>Search,Postcode,Party,ID<br><br>
<input
type="radio" name="search" value="search" /> Search<br />
<input type="radio" name="search" value="postcode" /> Postcode (4
digits)<br>
<input type="radio" name="search" value="party"
/> Political Party (Nat,Dem,Gre,Lib,Lab,Ind)<br>
<input
type="radio" name="search" value="id" /> ID # (digits)<br>
<input type="radio" name="search" value="person" /> Person #
(digits)<br>
<input type="radio" name="search" value="date"
/> Date<br>
<input type="radio" name="search"
value="division" /> Electoral Division<br>
<input
type="radio" name="search" value="always_return" /> Always Return
Data<br>
<input type="radio" name="search" value="state"
/> State</label><br><br>
<label>Search for
<input type="text" name="textfield" id="textfield">
</label>
<input type="button" name="subBut" id="subBut"
value="Submit"> <a href="http://lazerzap.com/oa/jquery/test.php">
Refresh Page</a>
</form>
<br />
<div id="box">You MUST Click Submit to Send a
Request</div>
</body>
</html>
---------------------------------------------------
Content of myserv.php
<?php
// Include the API
binding
require_once 'oaapi.php';
// Set up a new instance of the API
binding
$oaapi = new OAAPI('GamgSqGWzz5FGdQ6zVATqEir');
$function =
$_GET['function'];
$output_type = $_GET['output_type'];
$data =
$_GET['textfield'];
$search = $_GET['search'];
// Open Australia API
Call
$mps = $oaapi->query($function, array('output' => $output_type,
$search => $data));
// Output Result
echo $mps;
?>
--------------------------------------------------
So far it kind of works.....
But how the heck do I format the output into
something usable?
The cryptic hints at the open australia api didnt
help much.
I see a couple of examples on how others have implimented the api and I'm
dissapointed at not being able to do so without some help.
By the way.. Im a total noob. Im a code cut
and paster. (not a real programmer) This is the first time I have tried to use
jquery..
Thanks in Advance for any
help.