Can someone please explain to me how the data passed to jquery object, so it’s then accessible from jquery.
I.E.:
PHP script:
// $isrc variable is added by me to existing grid..
$isrc = isrc();
$grid->isrc = $isrc;
$grid->load();
object declared in js:
$.fn.loadGrid = function(user_opts) {
return this.each(function() {
// setup DEFAULT options
var opts = $.extend({
order_by : "", // sql order by
.....
},user_opts);
var $grid = $(this);
..some stuff to do....
});
}
... some additional function to call....
});
so how do i access $isrc data?
calling it after:
var $grid = $(this);
var isrc = $grid.data().isrc;
comes back as unidentified…
sorry i’m quite new to object oriented programming, although i did study Java and VB few years ago..
or at lease give me a link to a tutorial re subject?..
You have to pass the value from PHP to jQuery then do whatever you want with it.
You want to echo the value in php (Ideally in a JSON format). Then use jQuery $.ajax to call the page, get the data and then do whatever you want with it in javascript.
Here are some easy to follow Video tutorials for PHP & jQuery. It covers EVERYTHING from the basics to more advanced concepts including OOP.
Best of all.. They are FREE!
http://thenewboston.org/list.php?cat=11 <– PHP Tutorials (200 Part Series)
http://thenewboston.org/list.php?cat=32 <– jQuery Tutorials (200 Part Series)
If you go over these and learn from them. You will be able to do almost ANYTHING with PHP & jQuery.