{"paging": {"pageNum":2,"action":"Next","type":"","availableCacheName":"getAllFunds","selectedCacheName":"","showFrom":101,"showTo":200,"totalRec":289,"pageSize":100},
"Data":[{"sourceCodeId":0,"radio_fund":"individua
l","availableFunds":[],"fundId":288,"searchName":[],"fundName":"Asian Equity Fund A Class Income","srcFundGrpId":"PGI","firstElement":0,"las
tElement":0,"totalElements":0,"pageList":[],"standardExtract":true}]
I have json file with above format with two fileds,one paging and one is Data array.
I able to retrieve values of paging,but i am not able to retrieve the values of data array with .each function of jquery.
Any suggestions or inputs really appreciated.
How can I translate the following jquery code to Dart? I'm having difficulty getting the alert callback to work using js.interop.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(function () {
$('p').hide('slow', function() {
alert("The paragraph is now hidden");
});
});
</script>
Any help is appreciated.
var obj = {},ar = [],nothing=null,empty=undefined,word ='string',headorTail = true;
console.log(typeof obj) //object
console.log(typeof ar)//object
console.log(typeof nothing)//object
console.log(typeof empty)//undefined
console.log(typeof word)//string
console.log(typeof headorTail)//boolean
But how can i get the type of obj,ar,nothing as "object, array,null" - what is the best way to achieve this?
I'm having an issue trying to get an accurate running total for my calculations. When you enter numbers into the input field I get an accurate total for that line item, but the grand total comes out to a higher number. Note that this is a dynamic form and that the id's will change depending on how many form fields I have added to the form. Also, I have it set to make the calculations onKeyUp for each input field instead of a calculate button.
The code that calculates a single item is this:
function calcLineItem(id) {
var id = $(id).attr("id");
var Item1 = $("#Item1" + id).val();
var Item2 = $("#Item2" + id).val();
var Item3 = $("#Item3" + id).val();
function calcTotal(Item1, Item2, Item3){
var total;
total = Math.round((Item1 * Item2) * Item3);
return total;
}
$("#total" + id).text(calcTotal(Item1, Item2, Item3));
calcAllFields();
}
This will give me the total of this particular input field. The function at the end, calcAllFields(), is supposed to do the calculations for all items in my form to give me the grand total of all input fields:
function calcAllFields(id) {
var id = $(id).attr("id");
$('#target1').text($("#total" + id).map(function() {
var currentValue = parseFloat(document.getElementById("currentTotal").value);
var newValue = parseFloat($("#total" + id).text());
var newTotal = currentValue + newValue;
document.getElementById("currentTotal").value = newTotal;
return newTotal;
}).get().join());
}
The variable currentTotal is getting its value from a hidden field on my form:
<input type="hidden" id="currentTotal" value="0">
As I enter numbers a field the calculation for that line will be accurate, but the grand total will be inaccurate because the value for currentTotal will continue to increment with every key stroke I make in the input field. Any ideas on how to avoid this from happening?
Is there a way to give css syntax highlighting to any <textarea> using any bookmarklets, Favlets? I work on CMS where i write and manage CSS in plain <textarea> like notepad? is there a boomarklets to get css syntax highlight in <textarea> temporarily.
I have two columns.
The left column contains text of dynamic lengths.
The right column is of fixed height and will contain a set of images selected at random per page load.
I am trying to create an effect where while the user scrolls, the Image 2 scrolls above Image 1. When it reaches the top, the Image 1 begins to scroll up until it disappears, then Image 3 comes in and repeats the process.
As this is rather confusing, I made a short video describing the desired effect.
Video - MP4
I have begun trying to get it working in this jsbin but am at a loss for when the user scrolls back down and also when more images are required. I am thinking my current path is not the right direction. I'm thinking that employing something like jQuery waypoints is more the direction I should be pursuing?
I got a simple form and it works fine in ie but not working in firefox
onclick="login('loginuser','../private/loginuser.php?username='+email.value+'&pass='+passw.value,'loginresult');"
Any help appreciated.
I want to make text animation like this slide in from left. There are three text fields
Sports Cargo Bag
$14
Sale $25
I want these text to be set from jquery and slide in from the left like this link. This is my code JsFiddle
html
<div id="mainContainer">
<div id="logdo">
<img src="http://i.share.pho.to/7346a9ca_o.gif"/>
</div>
<div id="images">
<img id="introImg" src="http://i.share.pho.to/9064dfe4_o.jpeg"/></div>
<div id="headlineText">
<p id="headline1Txt" ></p>
<p id="headline2Txt" ></p>
<p id="headline3Txt" ></p>
</div>
<button class="btn btn-primary" id="ctaBtn" type="button">SHOP NOW</button>
</div>
css
* {
margin:0;
padding:0;
}
#mainContainer{ text-align: center;
width:160px;
height:600px;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
border:5px solid #BACAE4;
overflow: hidden;
position: fixed;
}
#images{
position:absolute;
top:200px;
left:3px;
right:1286px;
Width:130px;
height:152px;
}
#introImg{
position:absolute;
top:40px;
left:7px;
right:11px;
}
#headlineText p
{
text-align: center;
position: absolute;
top:60px;
left:-120px;
Width:120px;
height:269px;
line-height:1.0;
overflow:hidden;
}
#ctaBtn{
position:absolute;
top:540px;
left:26px;
right:0px;
Width:106px;
height:28px;
}
Why so many big and little sites inserts static files ( css, images, js, ecc ) in a subdomain like media.example.com or s2.static.example.com ?
What are the advantages ?
Why not just a directory like example.com/media/ ?
I need to populate the first box with the items from a db table. Users would choose from the first box, and either drag value(items) to the second for selection, or would select items, and then click a button to move them over to the 2nd box. After that I need to update the db with the selected values/items.
I just wonder is there's any way to fire any event via IE's event-triggering implementation - fireEvent. I've tried to use it but failed with all event except click.
The only reason i've get interested with this issue it curiousity, thus, any answers like "just do not trigger events, it is a bad idea" - all such answers would be considered, well...not full)))
thanks in advance
Hi
i was just wondering whats the best way to retrieve the following labels and values from this HTMl code using jquery and storing them in to a array or hash map of some sort where i have for e.g "DataSet:" : "prod" or ["Dataset", "Prod"]?
<table id="metric_summary">
<tbody>
<tr class="editable_metrics">
<td><label>DataSet:</label></td>
<td><input name="DataSet" value="prod"></td>
</tr>
<tr class="editable_metrics">
<td><label>HostGroup:</label></td>
<td><input name="HostGroup" value="MONITOR-PORTAL-IAD"></td>
</tr>
<tr class="editable_metrics">
<td><label>Host:</label></td>
<td><input name="Host" value="ALL"></td>
</tr>
<tr class="editable_metrics">
<td><label>Class:</label></td>
<td><input name="Class" value="CPU"></td>
</tr>
<tr class="editable_metrics">
<td><label>Object:</label></td>
<td><input name="Object" value="cpu"></td>
</tr>
<tr class="editable_metrics">
<td><label>Metric:</label></td>
<td><input name="Metric" value="CapacityCPUUtilization"></td>
</tr>
thanks
i refactored my entire application and gave it a whole new design. The one thing that seems to be broken is all the original link_to methods I had which were :method = :delete are now getting sent as a GET request.
The only thing I did that I can remember that might cause it is delete jquery-rails from the gemfile (I'm just getting it from google ajax).
Does anyone have any other ideas what I could have deleted?
hi all,
I'm using jQuery to parse some XML, like so:
function enumOptions(xml) {
$(xml).find("animal").each(function(){
alert($(this).text());
});
}
enumOptions("<root><animal>cow</animal><animal>squirrel</animal></root>");
This works great. However if I try and look for nodes called "option" then it doesn't work:
function enumOptions(xml) {
$(xml).find("option").each(function(){
alert($(this).text());
});
}
enumOptions("<root><option>cow</option><option>squirrel</option></root>");
There's no error, just nothing gets alerted, as if the find isn't finding anything. It only does it for nodes called option everything else I tested works ok!
I'm using the current version of jQuery - 1.4.2.
Anyone any idea?
TIA.
bg
I'm trying to remove a dynamic form field by click a button. It will also subtract whatever values it had from the total amount from my calculation. This is the code:
function removeFormField(id) {
var id = $(id).attr("name");
$('#target1').text($("#total" + id).map(function() {
var currentValue = parseFloat(document.getElementById("currentTotal").value);
var newValue = parseFloat($("#total" + id).text());
var newTotal = currentValue - newValue;
document.getElementById("currentTotal").value = newTotal;
return newTotal;
}).get().join());
$(id).remove();
}
Okay, it will do the subtraction portion of the code with no problem, this issue is with the last line to remove the field. If I comment out the rest of the code it will work, but not with the rest of the code. I know this is something simple, yet I can't seem to wrap my mind around it. Can someone please help?
I have an array of products that are stored as Strings in this format productname:quantity. The issue I am running into is that if a user adds one product with a quantity of x it is inserted into the array as it should. However, if they then decide to add more of a particular product a new entry is made into the array instead of checking if the product already exists and adjusting the quantity to the new value. oldQty + newQty.
For example this is my array:
["CBL202659/A:1","OUTER9:1","PALLET CARDS:1"]
If I add another PALLET CARDS product it creates a new entry rather than updating the quantity of the existing item to 2.
New array
["CBL202659/A:1","OUTER9:1","PALLET CARDS:1","PALLET CARDS:1"]
I would like the array to end up like this: - updating the quantity
["CBL202659/A:1","OUTER9:1","PALLET CARDS:2"]
Currently this is my code:
I use the split() method to seperate the String where a colon occurs and store the product name and quantity in two seperate variables.
$(".orderBtn").click(function(event){
//Show the order Box
$(".order-alert").show();
event.preventDefault();
//Create the Array
var productArray = [];
//Get reference to the product clicked
var stockCode = $(this).closest('li').find('.stock_code').html();
//Get reference to the quantity selected
var quantity = $(this).closest('li').find('.order_amount').val();
var item = stockCode + ":" + quantity;
var itemCheck = stockCode + ":";
if(quantity == 0){
console.log("Quantity must be greater than 0")
}else{
//If no Cookie exists, create one and add the Array
if ($.cookie('order_cookie') === undefined) {
console.log("CREATE NEW COOKIE");
//Add items to Array
productArray.push(item);
//Add Array to Cookie
$.cookie('order_cookie', JSON.stringify(productArray), { expires: 1, path: '/' });
//If the Cookie already exists do this
} else {
productArray = JSON.parse($.cookie('order_cookie'));//get ref to array
if(productArray.indexOf(itemCheck)!= -1){//It exists so update qty
console.log("EXISTS... updating item: " + itemCheck);
//var index = productArray.indexOf(item);
//var update = productArray[index].split(":");
//var name = update[0];
//var oldQty = update[1];
//console.log(name + ":" + oldQty);
//productArray[index] = item;
}else{//It does not exist, so add to array
console.log("Does not exist... adding new item: " + item);
//Append items onto the Array
productArray.push(item);
}
//Update the Cookie
$.cookie('order_cookie', JSON.stringify(productArray), { expires: 1, path: '/' });
console.log($.cookie('order_cookie'));
}
//Display the number of items in the Array in the Order Box
$('#order_counter').html(productArray.length);
}
});
I suppose the real question I am asking here, is if it is possible to search the array for a subString - containing productname: ??
Using jQuery and the Cycle plugin. Runs flawless in Safari, Chrome, Firefox, and the latest version of Opera. Won't run in older versions of Opera, and of course, IE. I know its running Java, because its picking up the rollovers.
This is driving me batty. Hopefully its something simple. Here's the code...
$(document).ready(function() {
$("#slideshow").css("overflow", "hidden");
$("div#slides").cycle({
fx: 'scrollHorz',
speed: 'slow',
timeout: 0,
prev: '#prev',
next: '#next'
});
Really appreciate the help guys.
I have a classified website, with pretty sophisticated searching, and I am about to implement a function where the last three queries is displayed for the user, so that the user can go back easier through the queries.
This because for each query the user has to provide a lot of input.
I have four questions for you:
I wonder, how can I save the actual query (SELECT * FROM etc etc)...?
Do I need to add some form of encryption to be on the safe side?
How will this affect performance? (I don't like the fact that cookies slow websites down)
Anything else to think about?
If you need more input, let me know...
Btw, the website is PHP based.
Thanks