I've not created an example on jsfiddle since it'd be pointless to do so since I don't have a place readily available to upload the file to be used. Below is the exact code that is supposed to be fired off and what's not happening.
from a different file aka any .js file. The slider code is on the html page.
function function_tester(identifier, value){
console.log('a');
}
The function will never be fired if the function is loaded from an external source, I've tried this in Firefox 7, and Chromium 13. Neither of them has the javascript being fired off, unless the function is defined above the function that makes the elements that are supposed to be sliders sliders.
When I do a JSON.stringify() on data from the $.ajax()'s success handler, it escapes all of the " instead of just storing them as such. Also the data, itself is unable to be used.
The way that I was using it from PHP was as follows.
<?PHP
$array['something']=array(3,4,7);
$array['something2']=array(5,6,"something else");
echo json_encode($array);
?>
The data when echoed out like that, and then used directly via JSON.stringify is the same as it would be by just echoing it out. I can also easily work with it as an array, and I am using the following 'hacks' from mozilla to handle the data.
function cache_write(key,value){ return localStorage.setItem(key, JSON.stringify(value)); }
function cache_read(key){ return JSON.parse(localStorage.getItem(key)); }
When using the data as.
$.ajax({
url:"test.php",
success:function(data){
cache_write('tester',data);
}
}
);
the data in 'tester', is escaped strings like what one would expect form mysql_real_escap_string(). Or something similar.
If I try to do the following.
var tests=cache_read('tester');
console.log(tests['something];
It gives an undefined.I have no idea why jquery's ajax method is returning the JSON data in a different form than PHP's json_encode gives when directly echoing it out. Even if i just do ' instead of ". It results in the same exact behavior. I imagine that it's similar for other server-side languages.
I'm not aware of any easy way to do this at the moment. The thing that I'd like to do, is to have jqueryui to use conditional arguments to decide which cache it should be reading from. The data is stored in the localStorage object via the mozilla hack.
But I don't know of an easy way to make it, so that jqueryui will easily wrap around it. Since I have a few input elements, and each one is going to have its own cache that it will be using. Since I do not want to have to use a ton of elements being built around them, I'd rather due it via a wrapper function. Since some of the inputs are changed dynamically and thus which cache they're supposed to be reading from is 'on demand' so to speak.
I'd like to be able to use it, instead of having to use my own code through it, but if there is no easy way to do it, then I'll just have to reimplement the code myself without using jqueryui.
That code, is not working even though said value that is returned is completely valid, i don't know why the maximum range is not letting me do it since the end result is a number. This would just let me do it with multiple items on the same page with the same class and make it slide and such based upon which one was used.
For some reason the code at the link doesn't seem to work with more than one element on the page. It says that it takes all selectors so i thought it'd work. I have one set up as '#query' and '#posts' and then a second as "#query2", '#posts2'. But it only seems to do the live update for the first one completely ignoring the second. They are both called/defined with
For some reason it doesn't seem to work with the second one. I don't know why this is, and it might just be some sort of issue with how jquery maps to the events but i have no idea why it wouldn't work since all other bindings work that i've used.
I don't know why but it's not working no matter how much i try to do it. I was planning on posting some elements on a page's div and one of them allows for mutiple things going on at once, as in allows for someone to have more than one of something. And since i don't think that it'll be working right if i try to pull it from 1+ items with the same name it'd just show the last one? Or is it that PHP would show them as a list... either way it's seeming that .attr() doesn't allow for a name change for some odd reason. And i was wondering if there was any function to allow for this to be changed easily written within jquery.
Ok, as i'm sure that most people here have heard about this plugin if not here's the exact link to it.live search link and here's a link to the demo demo and finally here's the code that i was using which is the revised version of it. revised Which was done by the main man himself apparently.
Well the problem i'm having with it is that it searches by list elements. And what i was going to do was to add in a bit of hidden text for the various items that i was listing mainly the hidden text/revealing thing it doesn't allow it to work for me. Essentially i was doing a <span class="show">Click here to reveal extra text</span><p class="hide"> some rnadom text.
here is a basic layout of the page itself. And for some reason it's not working. I"m guessing it's because it read the information after it. I guess i could create a sub list item in itself but then that'd not do a whole lot for me. Does anyone know how to edit it so that i can do what i'm trying to properly?
# <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <link href="../css/style.css" rel="stylesheet" type="text/css"> <script src="../scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript" src="../scripts/functions.js"></script> <script type="text/javascript" src="../scripts/jquery.livesearch.js"></script> <script type="text/javascript" src="../scripts/quicksilver.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('.q').liveUpdate($('posts')).focus(); }); </script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $(".hide").hide(); $(".show").click(function() { $(this).next(".hide").slideToggle(200); }); }); </script> <style type="text/css"> ul{ list-style:none; } </style> </head> <body> <div class="float" id="float"><form method="get">Item Creation Help, Search for the Topic<input type="text" class="q" name="q" val="" /></form> <ul id="posts"> <li><span class="show">Click here to reveal</span><p class="hide">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam luctus tortor in risus adipiscing at suscipit odio porta. Ut a magna ligula. Pellentesque porta, mauris eget malesuada mollis, risus est aliquet ipsum, vel commodo sem sem a arcu. Fusce eget nisi ipsum. Suspendisse vitae leo purus. Suspendisse potenti. Cras ultrices posuere lacus vel suscipit. Vivamus mauris lectus, pharetra a aliquet id, eleifend vel eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse non purus justo. Vestibulum tempor tristique imperdiet. Nullam mattis venenatis nisi, nec scelerisque nulla dignissim nec. Nulla vehicula nisi sit amet felis porttitor a rhoncus lectus blandit. Ut tincidunt justo quis felis sagittis et aliquet dui malesuada. Aenean erat mi, ultrices eu placerat ut, adipiscing vel turpis. Cras venenatis orci ac erat viverra nec mollis diam rhoncus. Nunc vehicula enim ac enim rutrum mattis.</p></li> <div> </body> <html>
OK here's the exact code right here. I don't know why it's not working for me. I click on it and it's not adding it to itself. I've looked over it but i think it may be an append issue, but the problem is that i thought it'd just add itself all nice and calmly.
<div id="toc">Table of Contents Click any of the "+"s to show sub items. <ol> <li><a href="#ghelp">General gameplay help</a></li> <li><b id="show">+ </b><a href="#nojava">Requirements to play</a> <ol id="hide"> <li><a href="#jsie7">Enabling Javascript in IE</a></li> <li><a href="#jsff">Enabling Javascript in Firefox</a></li> <li><a href="#jsob">Enabling Javascript in Opera</a></li> <li><a href="#jsas">Enabling Javascript in Safari</a></li> </ol> </li></ol></div>
Ok now that that's up there, for some odd reason it's not hiding those enabling javascript elements and quite a bit more that i have on the page. I was hoping to use .hide() along with slideToggle() to make the table of contents page on the help page alot easier to navigate to where the user wanted to go. This is mainly b/c the page is quite large at the moment, and i'm sure that the user doesn't wnat to view everything in this list which is put on the side.
I've looked voer it and it should be working, but it's not. I don't see why it can't, since as far as i knew, Jquery worked with all elements inside of html and not just divs, buttons and such other things.
i think this is a problem with jquery. As it doesn't do what i wanted. Essentially what i'm doing is for the first example. I'm goign to load a <div> which is originally hidden, then becomes visible after clicking the link which is intercepted with jquery and it's filled with a fragment of info i selected. Then after that, i have a link within it, what i'm trying to do is to allow the person to click on that link and have it reload that <div> with the information i have set. I'm using the same code but it's nto working.
The second one i'm trying to do is to load a page into themain page, then open up the same div since it's outside of the element which is being filled with the fragment of the other page. For some reason, when i click on a link within there, it's not calling it up properly. Is this a known limitation in jquery?
To start off with i'll post my code that's giving me the issues here and also, i have the scripts put into the page itself in the header so javascript calls are working it's just not working properly.
<a href="javascript:$('#reusepanel').load('main/tos.php #tos');" class="mainpage"> --Terms of Use Agreement-- </a>
now then on the page called conveniently tos.php here is teh anchor for it's part.
<form id="tos"> <ol> <li><strong>Terms of Use Agreement</strong></li>
<--snipped text -->
</form>
Also the reuse panel is within teh body and looks like this.
<div id="reusepanel" class="reusepanel"></div>
I don't see why in the world it's not letting me pull that document from there then put it on my page in the way that i want it to. Also here is the .css for the reusepanel.
Where should i start to get this thing working? i'm wanting the part of it that allows it to scroll and stay at the bottom of the visible window at all times. And then i'm sure i can figure out how to do the dynamic menu and such once i get done with that basic part. I just want to know where to start with is all. I'm currently developing a pbbg and i'd like to have the user menu to be down there as to make it look more interesting.