
shortysbest
Members-
Posts
414 -
Joined
-
Last visited
Everything posted by shortysbest
-
how could i slice a hash url to select a certain part only?
shortysbest replied to shortysbest's topic in Javascript Help
Like I said, the url could look like: index.php#!/profile&id=1 And I would want it to return just "profile", so only returning anything between #!/ and & Another way the url could look is like: index.php#!/home And I would just want it to return "home", so anything after #!/ -
I'm using ajax to send the form, and when i alert it out in the javascript it has it there as &. But it doesn't work once it's gone to the php script
-
When i $_POST[] the form it doesn't send anything to database after the & sign. How can i allow it to send without breaking the php code or whatever. right now I have : mysql_real_escape_string(ucwords($_POST['title'])); Thanks.
-
well no, I tried it with other names, random names and it still didn't work, as well as i have another script that has like 5 variables,none of which has a name that should be 'reserved' for anything
-
wow, so I did the 2nd suggestion (putting the code in place of the class variable) and it worked. I dont get why this makes a difference though.. its so annoying...and odd. lol
-
I do, I would have to update the files to my most current files, but, I recently discovered that it's Multiple variables that is causing the problem. html to call function: <div class="announcements-containers" onClick='view_announcement(this);' id='<?php print $id?>'> javascript code: function view_announcement(obj) { var id = $(obj).attr("id"); var class = $(obj).attr("class"); $("#slideshow").fadeOut("fast"); $(".homeantiqueholder").slideUp("fast"); $('.home-middle-content').animate({height: "490px", marginTop: "-10px"},100); $('.updatestream, #announcer, .announcements-container').animate({ height: "490px"},100); if(class!="announcements-containers announcements-current") { $(".announcements-containers").removeClass("announcements-current"); } $("#"+id).addClass("announcements-current"); $("#announcer").empty(); $("#announcer").html("<div class='announcement-loading'>Loading...</div>"); $.ajax({ type: "POST", url: "ajaxpages/view_announcement.php", data: "id="+id, cache: false, success: function(html){ $(".announcement-close").show(); $("#announcer").html(""); $("#announcer").append(html); } }); } When i delete the if statement inside, and the var class = $(obj).attr("class"); line it works fine in safari, however with both of them it does not. I cannot figure out why, it doesn't make sense.
-
Im using Jquery's way of loading data into divs and such, it works fine in firefox, but i just noticed it doesnt work in safari.. Why? my code: function save_changes(id) { var name = $("#product-name").val(); var price = $("#product-price").val(); var descr = $("#product-descr").val(); var photo = $("#product-photo").val(); $(".saved-changes").empty(); $(".saved-changes").append("<div class='changes-saved'>Saving Changes...</div>"); $.ajax({ type: "POST", url: "ajaxpages/update_antique.php", data: "id="+id+"&name="+name+"&price="+price+"&descr="+descr+"&photo="+photo, cache: false, success: function(html){ $(".saved-changes").empty(); $(".saved-changes").append("<div class='changes-saved'>Changes Saved!</div>"); $(".product-unsaved").empty(); } }); }
-
simple if() statements to toggle animate effect
shortysbest replied to shortysbest's topic in Javascript Help
ahh yeah, i see, Thanks a lot, works perfectly. -
simple if() statements to toggle animate effect
shortysbest replied to shortysbest's topic in Javascript Help
Honestly i only skimmed it, I have been a bit busy between tv and stuff right now, but thanks for the code. However, it says there's a syntax error with the 3rd line, not sure why.? -
simple if() statements to toggle animate effect
shortysbest replied to shortysbest's topic in Javascript Help
Thanks, I know how to do this toggle, if i just want it to go from no div being there, to it opening, but i want it to start at 355px by 200px, and onclick go to 712px by 400px, and then onclick again back to 355px by 200px, and repeat the same thing each time you click. right now after the 3rd click it expands, and immediately goes back to smaller size. -
This code sort of works, right now it expands the div from 355px wide and 200px height to 711px wide, 400px high. Then When i click on the div again to put it back to 355px by 200px (2nd if statement code) it goes back, however when i click on it again to expand it expands, and immediately changes the size back to 355x200 without me clicking it, How could i "toggle" this animate effect so it goes to the larger size, then back to original size? both onclick. function img_expand() { var done = false; if (done==false){ $(".productphoto").animate({width: "711px", height: "400px",},100) var done = true; } if(done==true){ $('.productphoto').click(function(){$(".productphoto").animate({width: "355px", height: "200px",},100) }); var done = false; } }
-
how do i allow only numbers and "/"? and also...
shortysbest replied to shortysbest's topic in Javascript Help
PERFECT. Thanks a lot. A lot more simple than I thought. >.< -
I want to only allow birthdays to be entered like: 1/9/1992 or 11/19/1992 no other characters. and i want to only allow the first part to be a number be between 1 and 12, and then the second only between 1 and 31. could anyone help with any part of this? the first part is most important, but second part is nearly as important.
-
what's the difference of the hashes in urls? "#" and "#!" What's the benefit or whatever of the !?
-
I'm not sure how to use foreach to send multiple form information to the database. <form> <input id="<?php print $row['id'];?>" name="attendance" type="radio" value="1" checked="checked" /> <input id="<?php print $row['id'];?>" name="attendance" type="radio" value="2" /> <input id="<?php print $row['id'];?>" name="attendance" type="radio" value="3" /> </form> I have a group of 3 buttons for three different options and this is in a php while loop,and there could be anywhere from 1 to 30 of these forms that ineed to send the data to the database at the same time. each one of these groups are next to a user to mark if they were present, tardy, or absent. I need it to get the id of the user for each one of these and send the value to the database as well.
-
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
yeah thats exactly what i did -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
take that back, just made $(this).val(); into a single variable and now it works perfectly. Thanks alot for your help with this whole part. -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
yeah, but i fixed it to work in the external sheet. I just had to add the javascript linking code to the page (<script type="text/javascript" src="javascript/ajax.js"></script>) since the page I'm working on is being called by jquery once before into the page to begin with. It's not actually being written in the code to the index page where the links are initially made. however with this: $(document).ready(function() { $(".attendance-box").change(function() { var id = $(this).attr('id'); alert(id); $.ajax({ type: "POST", url: "ajaxpages/attendance/send_attendance.php", data: "student_id="+$(this).val(), cache: false, success: function(html) { alert($(this).val()); $('#message').html('attendance sent'); } }); }); }); it doesn't alert out the val() of the option i clicked. The way you had the data: before there was an error with it, and i need "student_id=" to be part of it so another external page can get the value of that to use -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
oh i see, i had my javascript in an external file. I put it in the same file and it worked. I'm having problems with the data sending part of it tho -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
yeah i tested two on there too, it worked fine for when i did it too, however i put the exact code in mine and it didn't work. -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
yeah, but I have an array of anywhere between 10 and 25 of those menus, each having a different id assigned to them, that just shows it with one, which i have been able to get to work as well. -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
There must be a function to replace attr() that does about the same thing, just with a list of items? This code below works perfectly fine, only it only displays the first id of the list. $(".attendance-box").attr("id"); -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
Thanks, but this code doesn't work. I have tried changing it around some but still nothing. -
function like attr("id") but for multiple?
shortysbest replied to shortysbest's topic in Javascript Help
yes jQuery. This is the code that i am trying to get the id from. <div class="attendance-presence"> <select class="attendance-box" id="<?php print $row['id'];?>" onchange="send_attendance(this.value);"> <option selected>--Select--</option> <option value="1">Present</option> <option value="2">Tardy</option> <option value="3">Absent</option> </select> </div> This is the javascript i am using to get the value of the option selected which works perfectly fine, function send_attendance(value) { ####/////This right here works, but it only displays the id for the very first item in the list. need it for any of the ones selected var id = $(".attendance-box").attr("id"); $.ajax({ type: "POST", url: "ajaxpages/attendance/send_attendance.php", data: "student_id="+value, cache: false, success: function(html){ alert(id); $(this).html('attendance sent'); } }); }