Welcome Guest, Not a member yet? Register   Sign In
CI with Jquery/Ajax best practices
#2

[eluser]BradEstey[/eluser]
[quote author="blzabub" date="1272057404"]
My jquery code can be aware of this by use of base_url or site_url I suppose, but then I would have to embed the jquery code into my php file (CI view file) so that the base_url() function could be called. Is this really the best way to accomplish this? It seems like having jquery code in my CI view file violates some guidelines about unobtrusive javascript, etc. I was wondering if anyone was familiar with a better methodology for doing this.
[/quote]

All you need is like one line of jQuery code on your page calling a function that passes your variable (whether it's base_url or site_url) to the external jQuery script file containing the function. If I had more information information I could give you some exact code to use. But in most cases, you should be able to wrap your jQuery code in a function in order to pass variables to it.

Or another option would be to use Sessions of Cookies that both jQuery and PHP can access and modify independently, but that's a lot more complicated.


Messages In This Thread
CI with Jquery/Ajax best practices - by El Forum - 04-23-2010, 10:16 AM
CI with Jquery/Ajax best practices - by El Forum - 04-23-2010, 02:08 PM
CI with Jquery/Ajax best practices - by El Forum - 04-23-2010, 02:26 PM
CI with Jquery/Ajax best practices - by El Forum - 04-23-2010, 02:45 PM
CI with Jquery/Ajax best practices - by El Forum - 04-25-2010, 07:48 AM
CI with Jquery/Ajax best practices - by El Forum - 04-25-2010, 10:42 AM
CI with Jquery/Ajax best practices - by El Forum - 04-25-2010, 12:58 PM
CI with Jquery/Ajax best practices - by El Forum - 04-25-2010, 01:08 PM
CI with Jquery/Ajax best practices - by El Forum - 04-25-2010, 03:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB