fRAiLtY- Posted March 10, 2012 Share Posted March 10, 2012 Hi guys, Here's my dev page: http://dev4.printpartnerships.com/flyer-printing Thanks to the awesome help I got in the PHP part I've got that table displaying correctly underneath the drop-downs, it's dynamically created. As you can see, I have 4 drop-down boxes. The third one is where you choose the paper, although you can't operate it until you've filled the other 2 out. Once you select an option in there, for example 300gsm stock, I need the table to change. Now, currently I use a function called getFlyers300gsm in my PHP so rather than having a function for every paper stock I was hoping I could have a function called getMatrix() or similar in PHP that passes a variable to the function depending on the value of that dropdown, thus manipulating the table and reloading it. So to summarise, table loads a default set of figures on page load, drop-down box is changed, value is passed to PHP and table is reloaded. I'm not sure whether this is jQuery or Javascript or AJAX so forgive me if this post needs to be moved, I have little experience in JS. The PHP part of the equation I believe I can handle, it's just this part stumps me. If anyone can give me some help I'd greatly appreciate it. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/ Share on other sites More sharing options...
trq Posted March 10, 2012 Share Posted March 10, 2012 Manipulating the DOM is what jQuery was designed to do, I would start there. Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/#findComment-1325793 Share on other sites More sharing options...
fRAiLtY- Posted March 10, 2012 Author Share Posted March 10, 2012 Hi thorpe, Thanks for the response. So just to confirm, going on my description jQuery is the solution, not AJAX? I find the 2 a bit confusing that's all as to their differences! Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/#findComment-1325810 Share on other sites More sharing options...
trq Posted March 10, 2012 Share Posted March 10, 2012 jQuery is a JavaScript framework that was primarily designed to make DOM manipulation easy. It also now comes with components capable of making Ajax easy as well but that is beside the point. Ajax is something completely different. It is a method of asynchronous communication between the client and the server. Both DOM manipulation and Ajax can be achieved through JavaScript alone (after all, jQuery is written in JavaScript) however frameworks such as jQuery, Mootools, Dojo, Backbone (the list really goes on and on and on) just make this stuff a whole lot easier. Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/#findComment-1325811 Share on other sites More sharing options...
fRAiLtY- Posted March 10, 2012 Author Share Posted March 10, 2012 So if I read what you're saying is right, and referring back to my original post, if I want to pass a different value to PHP for data retrieval it's AJAX I'll need, not jQuery? My table is prepoluated with "default" values, however on select of a drop-down will pass a value to a PHP to potentially change the data in that table. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/#findComment-1325812 Share on other sites More sharing options...
trq Posted March 10, 2012 Share Posted March 10, 2012 if I want to pass a different value to PHP for data retrieval it's AJAX I'll need, not jQuery? Yes, you'll need Ajax, but as I said, jQuery makes Ajax easier. Ajax is not a thing you can download. It simply a method of communication between the client and the server, it needs to be programmed by you. Again however, jQuery makes this task easier then writing it all yourself. Seriously, if your at all interested in web development you need to learn JavaScript and one of the JavaScript frameworks. jQuery is the most popular choice. Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/#findComment-1325813 Share on other sites More sharing options...
fRAiLtY- Posted March 11, 2012 Author Share Posted March 11, 2012 Ah OK gotcha. One last thing, I'm working on a Magento platform which uses prototype. Is prototype "just another" library like jQuery or mootools, and as such a good option to try and work within this or is it not the case? I've read that libraries can conflict with each other and have used jQuery noConflict in the past to great effect, but am wondering if I have the choice to start with it might be be an idea to try and avoid the conflicts? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/#findComment-1326104 Share on other sites More sharing options...
cpd Posted March 11, 2012 Share Posted March 11, 2012 Yes, Prototype is just another JavaScript framework like jQuery (Y). Quote Link to comment https://forums.phpfreaks.com/topic/258636-manipulate-a-div-onselect/#findComment-1326190 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.