Is there anyway to get the alt tag to display quicker?
Also, I notice it doesn't show in all browsers. I know I should craft a javascript tooltip but I am looking for something really lite with minimal code.
When my member registration form correctly filled in and submitted, server responds with redirect link. But my ajax does not redirect the website. I do not receive any errors, where is my mistake?
<script type="text/javascript">
$(document).ready(function() {
$("[name='submit']").click(function() {
$.ajax({
type: "POST",
data: $(".form-signup").serialize(),
url: "http://www.refinethetaste.com/FLPM/content/myaccount/signup.cs.asp?Process=Add2Member",
success: function(output) {
if (output.Redirect) {
window.location.href = output.Redirect;
}
else {
$('.sysMsg').html(output);
}
},
error: function(output) {
$('.sysMsg').html(output);
}
});
});
});
</script>
asp codes:
If Session("LastVisitedURL") <> "" Then
Response.Redirect Session("LastVisitedURL")
Else
Response.Redirect "?Section=myaccount&SubSection=myaccount"
End If
How do I find if the div I'm cloning has more than one of a child div with a certain class, and if so only clone one of them.
Say the cloned div is .diseaseCon, and the child div(s) is .symptomCon, in the cloning action, how can I detect if there's more than one .symptomCon divs and only clone one if there are?
Hi All,
I am trying to build a shopping cart site. When a user click add to cart image on the product page, The product title will show a "The product is in your cart" text without reloading the page. I am using session and ajax but no luck so far. I appreciate any helps.
My html cold
<table id="<?php echo $productId; ?>" width="594" border="0" cellpadding="5" cellspacing="0">
<tr>
<td><img src="<?php echo "$brandImage"; ?></td>
<td <?php echo $productName; ?> //The "The product is in your cart" will be showed here</td>
</tr>
<tr>
<td><a class="addToCart" href="javascript:void(0);" onclick="addToCart(<?php echo $productId?>)">
</td>
My Javascript file (addToCart.js)
function addToCart(productId){
var url="addToCart.php";
url=url+"?productId="+productId;
url=url+"&sid="+Math.random();
$.post(
url,
function(responseText){
alert(responseText); //I wish I can get productData value from addToCart.php
},
"html"
)
My php file (addToCart.php)
<?php SESSION_START();
$productId=$_GET['productId'];
$cart=$_SESSION['cart'];
if(isset($cart)){
$cart.=",".$productId;
$product=explode(',',$cart);
$totalItem=count($product);
}else{
$cart=$productId;
$totalItem=1;
};
$productData=array();
foreach($product as $id){
$productData[$id]=(isset($productData[$id])) ? $productData[$id]+1 :1;
};
$_SESSION['cart']=$cart;
//print_r($productData);
echo $productData; //Not sure what to do to send $productData back to my addToCart.js variable
?>
I tried to make the code look simple. Any suggestion will be a great help. Thanks
Basically, there are some keywords that i want to pick out and assign a link to them dynamically.
How should i go about in doing this?
Let's say i have something like this;
<p>ruby, rails, php, python, django and sinatra</p>
and i would like to assign links to keywords like ruby and python, so the end results should look like this;
<p><a href="http://www.ruby-lang.org">ruby</a>, rails, php, <a href="http://www.python.org">python</a>, django and sinatra</p>
Any help or suggestion would be much appreciated!
Alright I'm trying to use a jplayer script to trigger the player in my template. I need to pass a value to the "mp3" option but I don't get how I get $music to print.
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
var music = $(".album-playlist li").first().find("input").val();
mp3: $music,
}).jPlayer("");
},
swfPath: "http://mysite.com/wp-content/themes/beta/libs",
supplied: "mp3"
});
});
Hi,
I'm using jquery masonry for layout. But I am considering moving to mootools.
I have found a masonry port to mootools, called moomasonry - http://www.crionics.com/products/opensource/mooMasonry/Demos/basic.html
With help here, I have a filter on the masonry divs by class:
$('a.filter').click(function(){
filterBoxes(this.id);
})
function filterBoxes(klass){
if (klass == "all") { klass = "box" }
$('#holder').find('.' + klass)
.hide()
.appendTo('#main')
.fadeIn('200')
$('#main').find('.box:not(.' + klass + ')')
.fadeOut( '200', function(){
$(this).appendTo('#holder') ;
});
setTimeout(function(){ $('#main').masonry() },500);
}
But, how would I filter divs by class in mootools? and have it reload masonry after each filter. See my site for example: http://jasondaydesign.com/masonry_demo/
Hello guys, I've made an application that makes full use of ajax, and what I need to do is:
I want a button with a description + image that when clicked is disabled and instead of the original image in the button, appears the ajax loading element id inside the button. And when the ajax loading is complete, the original image of the button returns to the normal.
Is there any good source on how to do something like this?
What do you guys suggest?
I am expecting when I go
$.each($(something).find(something), function(){
$(this).delay(1000).fadeOut();
});
then for each matching element I get a second of delay before it is gone. but what I get is a second of delay and then it all fades out. its 3am and I can't think. please help
hello!
i have a store model, this will handle my leaflet and my shoppingcart for my shop.
now i d´like to show all items added from an user to his leaflet in the index of store. in the store an user can change the quantity of the choosen items. and now i want to save that the changes of the different quantities in the database with one click on a button "update store".
so how could i implement an update over the whole index with one click? i´d like to do this with ajax and most dynamically. somebody has an idea?
i render all items into a form so far, but now i have the problem, when i submit this form only the last quantity and item id are included in the params.
further i pushed every quantity into an array and i want to submit this also as a param. but i could not.
please give me some tips, will be very fine :)
mattherick
Please this is not a duplicate thread do consider this one..thanks..
function loadAllAccounts() {
$('#Grid tr[role="row"] td a').each(function(row) {
if ($('#CGrid tr[role="row"] td.hasClass(sgcollapsed) a')) {
$(this).click();
}
else if ($('#Grid tr[role="row"] td.hasClass(sgexpanded) a')) {
return false;
}
});
}
First time the grid is loading with all the user data..at very firsst row each use can exapdn the grid to see subgird using + sign,, when use clicks + sign I am expanding the row to show subgrid,
above code is working at very frist time when I click expand button its expanding all the rows and collpase its colaapsing allt he rows perfectly,
but user open any row to see subgrid,, after clicking the expand button opened row will closing and closing rows will be opening.. exactly its doing opposite?
can anyone sujjest me what is this cause in the code?
thanks
Are there any existing table sorting libraries, or is there a way to configure tablesorter, to sort every two rows? Alternatly, is there a better way to semantially express my table such that standard row sorting will work.
I have an html table that looks something like this
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Some Data: 1</td>
<td>Some More Data:1 </td>
</tr>
<tr>
<td colspan="2">Some text about the above data that puts it in context and visually spans under both of the cells above so as not to create a weird looking table</td>
</tr>
<tr>
<td>Some Data: 2</td>
<td>Some More Data: 2</td>
</tr>
<tr>
<td colspan="2">Some text about the above data 2 set that puts it in context and visually spans under both of the cells above so as not to create a weird looking table</td>
</tr>
</tbody>
</table>
I'm looking for a way to sort the table such that the table is sorted by the data rows, but the row with the colspan travels with its data and is not sorted separately.
I have a JS Object like so:
var ob{
1 : {
id:101,
name:'john',
email:'[email protected]'
},
2 : {
id:102,
name:'jim',
email:'[email protected]'
},
3 : {
id:103,
name:'bob',
email:'[email protected]'
},
}
I want to check if this JS object already contains a record. If it doesn't then I want to add it. For example.
if(ob contains an id of 101){
//don't add john
}else{
//add john
}
Catch my drift? Pretty simple question. I just want to know the best way of doing it.
Thanks Guys!
W.
I'm looking for a way to programatically select all the content inside a TinyMCE editor instance.
The reason I need this is that I'd like it if all the text inside the editor was selected, as soon as someone clicks on it (I'm using TinyMCE in conjunction with JEditable, by the way).
Thanks,
Edan
$(function(){
$.ajax({
url:'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=user_name&callback=?',
//dataType:'json',
success:function(data){$('body').append('the data is' +data);}
});
});
the above code with dataType line prints out [objects] while with the dataType line commented it prints out nothing ...how can i get it to print the json output from the server rather then the javascript object?
Hi
Please give a look at this site.
maimei.ch
After 5 times opening a new site via ajax (fancybox) it crashes in IE?
One little thing is that i load a whole asp.net site via ajax in the new window. so viewstate and other overhead is there twice after. could this be the problem? if yes, why just after 5 times?.
is it possible to call just the content of an specific element via ajax? may be just the innerhtml of the body element of the called site?
Thank you and best regards
I have a <div id="comment_posting_holder"> tag that holds a form with two elements: a textarea box and a submit button.
I want to have the div tag (containing the textarea and submit button) disappear if I click somewhere "OTHER" than the submit button. I have a start for the code below. So upon leaving focus from the textarea, I can make the div tag disappear. I tried placing in a mouseclick event inside the blur function for the submit button but that did not work. Any suggestions? Thank you!
**Facebook does this with it's comments. If you click on a "Post your comment..." field the textarea appears and then it will disappear upon losing focus other than if you pressed the submit button.
$('textarea').blur(function() {
$('#comment_posting_holder).hide();
});
Currently i'm using below code which works well.
$("#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible").hide();
any optimised code?
i mean how to use :visible rightly?
I've got a table that you can edit, and I've got a simple code saving that list when you're done with editing it.
(the tables have the contenteditable on)
The problem I've stumbled upon is that if I double click on enter, the table gets divided into two separate tables with the same ID. This causes the code I'm using to set the localStorage to only store one of the tables (I assume the first).. I've thought of different solutions and I wonder if someone could point out the pro's and con's (if the solutions even works that is).
Make a loop that checks the page after tables and stores them into an array of localStorage-items.. I'd have to dynamically create a localStorage item for each table.
Take the whole div that the tables are in, and store that in the localStorage, when a user revisits the page, the page checks after the items in storage and displays the whole divs.
Any suggestions you have that can beat this :).. (but no cache, it has to be with the localStorage!)
Thanks
how do i minify this in mootools.
window.frames['buffer'].document.body.innerHTML
in mootools, this does not work:
$('buffer').$('body').get('html');
OR
$('buffer').get('html')
From: http://ejohn.org/apps/learn/#2
Function.prototype.bind = function(){
var fn = this, args = Array.prototype.slice.call(arguments), object = args.shift();
return function(){
return fn.apply(object,
args.concat(Array.prototype.slice.call(arguments)));
};
};
Can anyone tell me why the second return is necessary (before fn.apply)?
Also, can anyone explain why args.concat is necessary? Why wouldn't it be re-written as:
fn.apply(object, args)
instead of
return fn.apply(object,
args.concat(Array.prototype.slice.call(arguments)));
Hi all:
I have created a function for load event like this:
$(function() {
$('#dvGames').load(
'<%= Url.Action("Partial3", "LiveGame") %>',{ gameDate: '2011-03-06' }
);
});
and it works. Also, I have created a function for date change like this:
$(function() {
$('#datepicker').datepicker({
onSelect: function(dateText, inst) {
$.ajax({
type: "POST",
url: "/LiveGame/Partial3",
data: "gameDate=" + dateText,
success: function(result) {
alert(result);
var domElement = $(result); // create element from html
$("#dvGames").append(domElement); // append to end of list
}
});
}
});
});
but it doesnt work. neither it goes in controller action. My controller action is:
public ActionResult Partial3(string gameDate)
{
return PartialView("Partial3");
}
Please suggest me solution to this.
I am using the following code to open and close a div ( slide up/down ) using js
I have the slide down event attached to a button and the slide up event sttached to close text.
What I want is the button onclick to open and onclick again close the slide element.
Here is the JS
// slide down effect
$(function(){
$('.grabPromo').click(function(){
var parent = $(this).parents('.promo');
$(parent).find('.slideDown').slideDown();
});
$('.closeSlide').click(function(){
var parent = $(this).parents('.promo');
$(parent).find('.slideDown').slideUp();
});
});
The HTML:
<span class="grabPromo">Open</span>
and in the slide down area i have
<a class="closeSlide">Close</a>
Any help appreciated.
Ideally I want a down pointing arrow on the slide down button and a up pointing arrow to replace it to slide up on same button. And do away with the close link altogether.
Any help appreciated. Cheers