Welcome Guest, Not a member yet? Register   Sign In
google map app help (again)
#1

[eluser]boony[/eluser]
Hi All,

Sorry if it looks like I'm becoming a serial pest re this problem but I really need to solve a problem and hope that the wider community may be able to help (again :red: ).

In a previous post I mentioned that I'm trying to change the following JavaScript

Code:
var url = "phpsqlinfo_addrow.php?name=" + name + "⪫=" + latlng.lat() + "&lng;=" + latlng.lng();

to something that my controller can handle. The phpsqlinfo_addrow.php include in the original then specifies a number of $_GET statements to read the uri segments.

Many thanks to eoinmcg for some help here and suggesting that I use uri library to pass the uri segments. I tried the following (given that the js is in the head of the view).

Code:
var url = "<?=site_url('mapapp/test_form'); ?>/fname/" + fname + "/lat/"
+ latlng.lat() + "/lng/" + latlng.lng();

and after checking with Firebug get the following error..frame is not defined
and this is what is being read..
Code:
var url = "http://www.stanbordeaux.com/bws/index.php/mapapp/test_form/fname/" + fname + "/lat/" + latlng.lat() + "/lng/" + latlng.lng();

So, I think I've narrowed down the problem to passing the url to the controller. Obviously, my solution is not working but I can't resolve the correct syntax!

Therefore, if anyone can suggest the correct way to set up the url I would be forever (well probably not forever but at least for a day or so :cheese: ) grateful...
#2

[eluser]eoinmcg[/eluser]
Hi again boony,

Seems to me this is a javascript rather than CI problem. %-P

Quote:and after checking with Firebug get the following error..frame is not defined
and this is what is being read..
var url = "http://www.stanbordeaux.com/bws/index.php/mapapp/test_form/fname/" + fname + "/lat/" + latlng.lat() + "/lng/" + latlng.lng();

Is that 'frame' or 'fname' undefined? There's no reference to frame in the url var. If it is fname, which I assume you're grabbing from a form it appears the form is empty / the value hasn't been captured. Of course all of this is guess work. You need to post all the code so we can understand what is going on before...
#3

[eluser]boony[/eluser]
Hi,

Yep, I finally realised that this is an AJAX problem (doh!! And they say I'm slow he he). I figure that I needed to get my hands dirty with some JQuery and CI integration..

Hopefully, this will be resolved soon (has to be I'm already 3 days late on the deliverable but hey who's counting)
#4

[eluser]John_Betong[/eluser]
[quote author="boony" date="1254707414"]Hi,

Yep, I finally realised that this is an AJAX problem (doh!! And they say I'm slow he he). I figure that I needed to get my hands dirty with some JQuery and CI integration..

Hopefully, this will be resolved soon (has to be I'm already 3 days late on the deliverable but hey who's counting)[/quote]
 
I am not familiar with JavaScript but if it was my code I would try and do the concatanation in CI. After the string is built then test it by echoing or calling the URL, when it is OK then try and pass the single URL through to the JavaScript.
 
Also I would remove the short-tag and replace with '<'?php echo ... ?'>'
Code:
<?php
...
...
...
$this->load->helper('url'); // just in case

$url = site_url('mapapp/test_form')
      . '/fname/'
      . 'fname'
      . '/lat/'
      .  latlng.lat()
      . '/lng/'
      .  latlng.lng();
echo $url;

?>
<script type='text/javascript'>

  var url = "<?php echo $url ?>;

</script>
 
 
edit: spelling, etc
 
#5

[eluser]eoinmcg[/eluser]
Quote:I figure that I needed to get my hands dirty with some JQuery and CI integration..

Check out the form plugin, in my experience it's one of the easiest way to send forms with jQuery and AJAX
http://malsup.com/jquery/form/
#6

[eluser]boony[/eluser]
Thanks folks,

Its all about trying to get google maps and jquery/ajax all working under CI and as I'm learning as I go sometimes you get lost. When :question: I get it all working I'll post the solution..
#7

[eluser]eoinmcg[/eluser]
Best way to learn Wink

Good luck




Theme © iAndrew 2016 - Forum software by © MyBB