Welcome Guest, Not a member yet? Register   Sign In
Google Maps - Passing Data via jQuery
#5

[eluser]bretticus[/eluser]
Well, actually, I meant something like this:

Code:
class Maps extends Controller {

    function Maps()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->model('markers');
        $data['markers'] = json_encode($this->markers->get_all());
        $this->load->view('maps', $data);
    }
}

The model would use something like result_array() to get the results as an array.

Then, in your view, just print the $markers variable inline:

Code:
(script tags)
var markers = <?=$markers?>


Messages In This Thread
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 03:34 AM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 10:27 AM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 01:29 PM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 03:45 PM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 03:52 PM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 04:25 PM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 04:54 PM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 04:57 PM
Google Maps - Passing Data via jQuery - by El Forum - 03-17-2009, 05:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB