Javascript should have no ties with a server side programming language. The only connection between javascript and a server side programming language is the url, and only when you add the programming language file extension to the url.
I think the concern; why do i need a whole library to add AJAX, is false because if you want you can extract the AJAX parts from the javascript libraries. If you apply this on CI you can say why do i need all those other libraries, i only want MVC. Maybe you don’t need the functionality while you are developing one part but you could use it for another part of you application/site.
Javascript should have no ties with a server side programming language. The only connection between javascript and a server side programming language is the url, and only when you add the programming language file extension to the url.
@xwero, would you agree that JavaScript gets tied up into our presentation to a great degree if we’re relying on javascript events to trigger AJAX calls and the like? When considering the entire JS event model (onClick(), onContext(), etc.) we’re reminded that all those event handlers get built into our presentation logic when we’re coding our View parts of the MVC. Whether this is a form or any other block level HTML element. Many times these are dynamically constructed with a View file using dynamic data as well. AJAX callbacks paths are often generated in this manner for View files.
If we consider these points, it makes sense that the client-server environment we are in requires some construction of the client-side foundation on the server. That implies javascript and php will be linked up in some way.
I think you hit the nail on the head, it’s the choice in how one implements it that drives things.
Choice in which library to choose is important to many of us. I’m personally hoping we’ll be able to do a drop-in replacement of jQuery once it is included.
Randy the event handlers you are talking about are in the view which outputs html. It should not matter if the content of the view is generated by php, python or perl. As long as the html stays the same your javascript code doesn’t need to change.
onClick(), onContext(), etc.) we’re reminded that all those event handlers get built into our presentation logic when we’re coding our View parts of the MVC.
What!? Who still embeds JS into HTML!? Come on guys - this is almost 2009. JavaScript has no business inside your HTML views. It should stay in it’s own file - far away from our valid XHTML.
Alrighty then Xeon - tell me how you’re going to press a button and invoke an AJAX response from the server without an onClick() javascript function within your HTML tag?
Xeoncross when i responded i didn’t mean i still use those tag attributes but you need to link the event functionality somehow to tags. The way it’s done now is by using classes but they have to be added too. And that is what Randy meant by the link between php and javascript.
I try to use dom traversing as much as possible but sometimes you have to use classes or ids.
Are the attributes written out of XHTML? AFAIK they are still a part of the specification.
Xeoncross when i responded i didn’t mean i still use those tag attributes but you need to link the event functionality somehow to tags. The way it’s done now is by using classes but they have to be added too. And that is what Randy meant by the link between php and javascript.
I try to use dom traversing as much as possible but sometimes you have to use classes or ids.
Are the attributes written out of XHTML? AFAIK they are still a part of the specification.
Ok, I just wanted to point that out.
As far as I am aware, event handlers built into (X)HTML are invalid and cause issues with some of our favorite browsers. Plus, it is much cleaner to tie events to DOM elements by a class or ID than it is to place a bunch of JS in the element.
<a href="#" class="ajax_popup">Modal</a> vs a href="#" ONMYEVENT="MYJAVASCRIPTFUNCTION;"Modal/a //JS is filtered in this forum. ;)
Alrighty then Xeon - tell me how you’re going to press a button and invoke an AJAX response from the server without an onClick() javascript function within your HTML tag?
haha, I think you’ve been in PHP too long my friend. Go check out jQuery or Mootools and see what you can do with a good lib behind you. It will help you to break out of the old embeded JS ideals. (And yes, you can still use DOM and events even if you don’t have a JS lib)
The EllisLab Team, namely Derek Allard, have already stated that some jQuery goodness is coming to CodeIgniter. I believe they are making use of it with EE2 - I would assume after EE2 is released we will see a new version of CI released shortly thereafter.