php - Codeigniter and jQuery css switcher -


I'm following on creating a style switcher with PHP and jQuery, now the PHP function gets the data in the tutorial , Which is not available in the codiginator, I was hoping that someone might be able to clean my attempted apology?

My PHP function

  function setBackground () {$ style = $ this- & gt; Uri-> Segment (3); SetuKi ("style", $ style, time) + (60 * 60 * 24 * 30)); Echo $ style; }  

My HTML and jquery calls

  & lt; Ul id = "options" & gt; & Lt; Li & gt; A class = "option" href = " 

jQuery plugin

  jQuery.fn.styleSwitcher = function () {$ (this) .click (function () {loadStyleSheet (this); Details Is false;}); Function Loadstyle Sheet (OBJ) {$ ('body'). Append ('& lt; div id = "overlay" />'); . $ ('Body') CSS ({height: '100%'}); $ ('# Overlay'). CSS ({Display: 'None', Position: 'Full', Top: 0, Left: 0, Width: '100%', Height: '100%', Zyndex: 1000, Background: 'Black URL (IMG / Loading.gif) no-repeat center '}) .Fadeine (500, function () {$ .get (obj.href)' & amp; js', function (data) {$ ('# stylesheet') .attr ( 'Href', '/ media / css /' + data + '.css'); cssDummy.check (function () {$ ('# overlay'). FadeOut (500, function () {$ (this) .remove ();}}}}}}}}}});} Var cssDummy = {init: function () {$ ('& lt; div id = "dummy-element" style = "display: none" /> ; '). AppendTo (' body ');}, check: function (callback) {if ($ (' dummy ' () (); CssDummy.check (callback)}, 200);}} CssDummy.init ();  
P>}

Clicking on the link to change the stylesheet I get this error which goes back through firebug,

An error occurred

The URL you have submitted is not allowed in.

The URL is being sent,

This example is a green color choice Clicking

You are not calling function setBackground () in jquery.

  Feedin (500, function) ($ .get (obj.href + '& js', function (data) { 

tags you I need to add id red and blue in. It needs to do some such call.

 . FadeIn (500, function () {var color = $ ('. Color'). Attr (' Id '); $ .post (' Yourphpclass / setBackground / '+ Color, ... ...  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -