Ajax and Javascript - get filename - javascript

How can I get loaded filename? I have to put this instead of header, but I don't know how. I've tried to add additional parameter to xmlParser function, but actually it didn't work for me. Here is my code:
$(document).ready(function () {
doAJAX('LoadedFile1.xml');
doAJAX('LoadedFile2.xml');
});
function doAJAX(url) {
$.ajax({
type: "GET",
url: url,
dataType: "xml",
success: xmlParser
});
}
function xmlParser(xml) {
$('#load').fadeOut();
var myDate = new Date();
var currentdate = new Date();
var n =
currentdate.getFullYear()
+ ("0" + (currentdate.getMonth() + 1)).slice(-2)
+ ("0" + currentdate.getDate()).slice(-2)
+ ("0" + currentdate.getHours()).slice(-2)
+ ("0" + currentdate.getMinutes()).slice(-2)
+ ("0" + currentdate.getSeconds()).slice(-2);
var x = false;
var y = false;
$(xml).find("programme").each(function () {
if ((parseFloat(n) > (parseFloat($(this).attr("start").slice(0,-6)))) && (parseFloat(n) < (parseFloat($(this).attr("stop").slice(0,-6)))))
{
$(".main").append('<div class="header">HEADER</div><div class="programme"><div class="title">' + $(this).find("title").text() + '</div><div class="timec">' + n + '</div><div class="time">' + $(this).attr("start").slice(0,-6) + '</div><div class="time">' + $(this).attr("stop").slice(0,-6) + '</div><div class="description">' + $(this).find("desc").text() + '</div><div class="date">Published ' + $(this).find("category").text() + '</div>');
x = true;
}
else if ( x == true && y == true)
{
$(".main").append('<div class="programme"><div class="title">' + $(this).find("title").text() + '</div><div class="timec">' + n + '</div><div class="time">' + $(this).attr("start").slice(0,-6) + '</div><div class="time">' + $(this).attr("stop").slice(0,-6) + '</div><div class="description">' + $(this).find("desc").text() + '</div><div class="date">Published ' + $(this).find("category").text() + '</div></div>');
x = false;
}
y = true;
$(".programme").fadeIn(1000);
});
}

Related

Why I can't play the MP3 Base64 string neither way?

Here are all the code:
// jQuery is loaded already
var s = 'data:audio/mp3;base64,UQzAwAAAAAfdlRSQ0sAAAAEAAAAMTA5VENPUAAAAAUAAADJwbDJV1hYWAAAABAAAAAAd3d3LmZsYXNoOC5uZXRUSVQyAAAAGAAAAN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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFRBR9W+s6TL2LLEKHNjLmNoaW5hei5jb20pAAAAAAAAANW+s6TL2LLEKHNjLmNoaW5hei5jb20pAAAAAAAAANW+s6TL2LLEKHNjLmNoaW5hei5jb20pAAAAAAAAANW+s6TVvrOky9iyxChzYy5jaGluYXouY29tKSAgICAgAG0M';
// failed 1
var a = $('<audio>');
a.attr('src', s);
try{
console.log(a[0])
a[0].play();
}catch(e){console.log(e)}
// failed 2
var sound = new Audio(s)
sound.play();
The both ways are failed. Is there anything wrong with my code?
Thanks,
Your MP3 data is invalid. If you decode the base64 data and load the result in your browser, I doubt you'll hear anything.
If you replace the data with something valid, then it should work. Here's an example:
var s = 'data:audio/mp3;base64,//uQZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAWGluZwAAAA8AAAA4AAAp9QACBQUHBwoKDxMTGBgcHCAgJSkpLi4yMjY7Oz8/RERKS' +
'lBVVVpaYGBlZWpvb3R0eXl+goKHh4uLkJCUmpqenqOjp6essbG1tbq6v8TEyMjNzdLS2Nzc4' +
'eHm5uzs8fX1+vr9/f8AAAA5TEFNRTMuOThyAksAAAAAAAAAABQwJAbATgAAMAAAKfXcScCrA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAA//sQZAAP8GUAPpAAElANIBegACIAAVABEgAASVAvgGLAAAgGAJAP/////8QO3' +
'qdw//////+o4+H6hgQDEEP/////XqS6vRfFv/////1LzL0ixOTIKgg//////bgwKUXPEYSV/' +
'X6X1Z3/+xBkCYzQbwBDiAEQCAiF+KAAAm+B1AMSQABAIC+AYcQACAQQzNEAEgH/////uoUpF' +
'q4vHBMP/////66yz9qjbiff1NuoNr/////+lz17lmyaEh/////+W64DdiBCTQf/////77elo' +
'v/7EGQTDdAqL8WAABP+C6AIsAACTYGIAQ4gBEAgLoAiBAAIBK1Yna4ADMeMbvjjf13/6+VgA' +
'UP0AE/ROAAhEI/c68JBn60Z+++gD5KvM00yEH/////25QBbligxEKAsBBUOiW32dug0//sgZ' +
'CCAAUchQZUEYAINwAhRoAgAinDHK7k5AAAAACODACAAAAAAaagDXgyOzB9C/rcWSHP3YVIP3' +
'91EkgPhS9lqjAAVwVgT5bTas+owEjGOLwNx2V9a6KRPDIiDxzhZv+/yBCBw2QPocFKB8aoA0' +
'hVRMAHzREtJALdZjczqtKXAnf/7QGQKAGG3LMzPJGACDoAYWOAIAIeksTUkmGnINIAhLACJM' +
'BcsnAjTO8bauViEfm5E3+3UvF6KRTxedAELjQjYWlDgltG0AUAAActZ/////v7GOvNgfJUyh' +
'AGDqNCbRtNAENji08nSwGMMCSZ5OPqH3zX9bODrellO1MAlq42DOk4VISMa3Qj0NAXMugusU' +
'T3pgAQBHOf/////o7ZSwP0AIEgCLKIDYapAQCADZtOAsGUwvXEL//tAZAsA4ekoTeEmGeIO4' +
'BhjACIAB7S5NCeYaMgogGIMAIgARsIO3JqDzjj0+dzUI8qIwIftFMpqe45wEFhu0E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oyb91i9UnecIcPsihmc2UtdkdtEwFe2YYR9upRjsTo48fjMCjABYD/////6CrNNCnv' +
'Qk+MuICAAQMdbAEWnzEswCsiUi6gcBphY4azzWJUWUmhsgsWz9RBXV6Wn/5TnWSAz82BtyNH' +
'chZkmODIpoHkAAR///////6FdWAgAEAo//7QGQDAOH5MFXp8htaCeAYsgACAIgQu1lHxMuYJ' +
'wBiBAAAAmgBEbWS2a5aykxWFXFx8AqJUQN31iGoVqTqGTb8co09PBfp3IlkCqVFbMjioW0KR' +
'UKiM9ajqZhxrAAMB///////0Zn0IAQW26AItrX3A0uCtxPd6y8BPn1pJaAnY8nU1Y/m/2RHh' +
'vJg4mYduN8A2a/6yd1se96LPjPhqM1FZOKXgH6FrH//////2vbnZJX4EAQU//tQZAIEYhEg1' +
'FFzG1INwBhjAAIACWTHSU1AdEgxAGH0AAgA2uADm+2uKQqFOS7h6JMgdpCwGxDbOiBRY4z96' +
'0h0iHpp2pmIuE+z84KhLzIC8mdQSc5HPB3aoU1KZ2Q28UaAADAB//////7nI84G0shAEEQAc' +
'+xar2IxGgcWlFqYzwf9uhlZQZkXhBGfKWSEAcupV5FJDdLsCYW00bTYU4abK/NAM55pAnkn6' +
'xLodHT0algx+0sjOp6CZAIABwBv//////+jYlVpgUABARp4Af/7UGQEAOJ4MdPrLTUSDAAYM' +
'QAiAInAu01NQRRIIQBjRAAIBHsM8ZmJU8sKBaeX1Mattupm1jVsQjlm/vKcKLIphMWfdYGc1' +
'Ne4mhCX6/okRWJzW2FdBnrKhC/vz53f18yCUvl6U/cpptIHAj/////9H6yjVvJpXCAABNrAD' +
'De7eNafiQQHs01LhuUNzMZZCB7hx+xnhTkgImWyzCtlyiCNPXdluJEpfbYaIkRxZLgpghqG8' +
'CFU9oS5UR02m2g9Iyzb6bBWx///////tfpVMoD/+2BkAQDiejHU6w9Dsg6gCFMAAkwJ7K1Np' +
'ekHyCmAYUgACADAAYMVlAHP1Vp79qusrVij/LlMYsFJj3X40uJQ7h9v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2/0Rs2qskoapdGYpDblGi46OFSbCEITBYD/////' +
'/+tcCXBWnmhQEbJImwBWWD/+0BkBQDh8jFaaWNFTgpgGMEAAgEHkLlRLAyzaCwAIMAAiTB6c' +
'62EbVKv4BalGfwVkMbvHasxJHwlpKqwrSqfBYQjirVfdAAVW7+f93EUHUmYLjxa6YumAY///' +
'////uepzVtAAA3JgcyywvU224K7+/zLfPC9357IubwyZS55JfUiIt6e8ZTBHofFIsE2RzdBZ' +
'nfzSWd3AQztoaPkNvP//////ZlqJtItCVWWEUAmySNsAZlC3P/7QGQFgOH8MdpowEKODOAYq' +
'QAiAIhgrVXsDNUoIpjiSAGHxL54VyAXg5cz/lBc8sM06rOMSVOVfGjWuYSuL/tGjhHFB8v9j' +
'hq1nMpwsIZt3Vn2caw29C1gwAAABgNv//////0dAogAgABRa2UgBz87mNjOgThu2b/PzqFRE' +
'spMv/PsNuE+c82lFRs5Cid2ILLkx3pzblt6R57CuFc1hX9HONq8zxCpUrABc3v7QkzQG3Iwy' +
'CrJ//tAZAKA4fEyWekHMrwMQBhiAAIAh4SzVaY8bKg5gCFIAAkwImwAmrrDoF8WGvxLLIniE' +
'OQkxDJbZhmjkzHhJ5bC6KiPk4Glnz3Am6r5r7O9u1YmRtWFVmG7mZpmAAQH//////0rVXlyb' +
'hAYAFtbSgA76M/D49gK5Ten5cBtzu+L/pNxBM3WNdTDlTOKhn23MnbmUJlkEfPNo1qMRi41o' +
'haEjNcZWQP/////9fHpEgYFEh0mDYD/+1BkAQDh+StT4wsbugwACKIAAk0IUJlJI2BliCeAY' +
'sQACARAAncsBz8p25YxkxFm3Xyz1nJCGEmhZ87RRLFmaztxftZJkvzciCisQNpLuf27uZcFH' +
'mRbGiI4ekw9lAIGAEgH//////vTamHFEgAH1xgZIUU5KG1EizfJFyxf1AZny8laLc5SXVU8y' +
'He4IOBB0PhnO2wYlyhwmhigplAExA5nVEYYmj7HDaWaC4JYlj//////8gnS8VpxgIAuyOJQA' +
'VvAj6b1Q3hPTYm3vbWD//tAZAsA8hIt1WnmHKoKoBiwAAIBh8ipS4HgZYgjAGDAAIgAYaMRc' +
'+EwnAq4g/4xFb7bOxYYtt+sZmcoXDc2MmA/3MoDGPM19bDjUPvF9Fb///////KXKe0VNFAAA' +
'ARrlAEvIISqqmXcnJ2//9g0xxfLUi/memMWnXQGzsfZCwpZHlC8i18s4TjhRi73BKru7RBB2' +
'UWHpdTT//////9xi2svIAAC2SAVQ/GWBSmE6Mi5apt1mEj/+0BkCgTiDy1RyRkx0AvgGIMAA' +
'gAIDMVETAzTCDKAYYgACAIBiz17efv1j3u+7vnZl/PMLRmt3WSiL7F6izwXMuBqjtp3OnPve' +
'sxtaNcrEjQwAADAB///////9wohVHAxzlPfjzJxiBaGLyPcZ1XS0OXX8qPfP453FGO81yhU8' +
'qwI/Myhju8NH/f4cT31epi8nt2+whlaUmxSffMT7bAf//////cBkgKGRqWVSAXGgseWEIYOZ' +
'//7QGQFifIIJVEQejFiDUAYYwACAAhInUTMjTMILQBggACIAB+F0sc3egcpDPfXud3haSD78' +
'd69JKLKyEah77t6Tp9fPaUJu2EUplGNvkQrg+W0KcBC9JAj5wAAKAP//////y9AtUVDdXMdU' +
'/ZK3y9yOZ/amNXPShprPPL7y2berqsFvhOwoQTGOGMEFJqzWmLKVWYjcTampadJIIpgKflFz' +
'kDKhlz17yCP+r////2XkbaxGB2w//tQZACA4hQu0ssDNLoMgBjSACIBh/SVRsyM0wgkGOFMA' +
'IvBAApYIC9WpZvOhxLAUipyc7l9dogIbSYSPuP+23D04QaGrTYKu/d9mNsstVtkNXCYff5KA' +
'r/fNG6xeW0NYdzaVjcgAID//////2mk+pQAQBzIgWfufYuusVCx5ymot9zstbE6oXN45fhMJ' +
'sY99BxAgyiPVxGZvCP5uTnQ+YuAFKNb6IItRij8stBsBuHk2aAELQvmUxsTShAAAABUrAc1K' +
'bVbDq+RvFA9+qyAyf/7QGQKgOIFJlJjD0JCBwAY8AACAYgovUkh5MWIJJkhCACPwAF5hndRb' +
'ddFG7+byBBtvibFormOIj9oleUlnuVnS6uwgKc5cIILZrRWF6iv///////TTKAAPVUAJZ4TV' +
'UtAyWXT+v1bhgJBkGFP/90qhl7ntKO+v7qwmIem1p7tM6hnrMpfo+M1uaAn/rN+tBTw0eXYj' +
'hcgwG+NiIQ0FRB3wBypgCYDFy0JIUkXVkX5/XaUBw7m//tAZAqE4f0l0bB5QWILoBkBACIBi' +
'MzJQMTkxYAugCBAAIkw56/jhXWnY7u4EUYsY/RlWE557uFSajrs4d3Q82u0QDaKFbzFTojfb' +
'AsIUCH//////oe4XWVmYJQAAdRiNdcp0dUJ0nxhWOPZYKrnOBDecO3tWVE0RrfZKX0JI9mpx' +
'75sXWfPiuVEVLx/sXG/I9Ck7dnaSa9/bfszT/WO1Tf/////8gWN3HaFiaogAACUQaAL263/+' +
'0BkBIRiDjBRUwMssgxgGGEAIgAH2MdAQeRjyCuAYeQACAJHTX5SQgKfwbR3tXaQqXUK5+NjP' +
'SjdB6nPBav8QPzapXJsrWRmidrHst7giuuz3QRoRUYaOLMJzlQQ//////9UKnmNcRWipAALu' +
'Eu1vJCBs6CZ+pXrcEOLV9WuXuZjocC495AUwn6LgtDNQklImgRj1CINdk+gCmQGL+L1vJvUu' +
'nvBbh5ABAW///////2NogIICf/7UGQBgOIYKNAw2RliCwAYgQAiAIgcx0LsGHJIJYBjSAAIB' +
'IBGRafTphxwiqg23qthXBkIsnSYRul3mghdfz28cQaai8NwyIqdgOyYOMfm5nwDBqoGRDATC' +
'gQQ59TluqA8wnAEP//////oJE6TakAIoEQAXvp88qXAdkUThm3vHdx6xv9/l3meFMnn3vb9x' +
'saXJy9pvXIchcuzi+Zv5fUII9BIJcJg0k/r3J7JCYRJAH//////t7tK6kApogwAc12miNyVk' +
'qCi03IuYa4hzGz/+0BkCwjh/RzROw8zkg7AGGMAIgAIuMc+pORliCoAIUgAiAJd8GavRYvu0' +
'cveMu3+MAeVSYd3RRP2MmXSWin3Zk4r+3lejA9Pf6A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Y2ySrd4eJQx1ACB10VFeVnHxAggBAOUChtGdiApBTYzmchrxUrWgW/nPZS4v' +
'eUI5ZuPuwKguDIsvuVkfuTCHTdijMagwlRGH3d0jlH6KPJpQ+qM/9htu8emaErUB///////E' +
'aQAWgQL1VCCAiDGiCQBF3SHmBkONxtG/qmC//tAZAoA4icyUuniNIgLYBhjAAIACQjJPMNlB' +
'YArAGHMAAgA70n3S0ENtU4+0GwHXXpYSSzbPbNeFNiKdfw+l7ueP3z+LZhrp5Npi02dbWk0v' +
'LviDAAAUAf//////696wIQAAAQaMRMFdJoHvq401WxFyK63Yz38TGIU46TGiCsDhXNJVLMGz' +
'KdJcyiq5EQqJqJxuOtVSkWSsMCtnveijyBWbem0guLMgwAf//////31uOLVSAj/+1BkAQBiW' +
'jDPMwg1MgkgGFEAAgCIeK9HR+BwSDAAYjQACAABAS3CzUkEQjAPNDnIAwu8TvZdO55SShlRk' +
'AoXe1nl9xoNWozPHhQl63mWVRtsSsItywYQlOJtX2Xi7RraIF6ObJfYtLYLRcGBgI///////' +
'1VyFgoJNJA0ARI79giahARWWLDlxhQqeBuzxTuBEt7ubv58lUsEg7vYMQPLVHqF7QILiKHB+' +
'CJVn6eDBr6ovkwSFgbTePOIAAYALv//////68uqCBAAz4gBbWAb//tQZASFYjMwTyjYMXILo' +
'BhzAAIACWTLOAyhMwAugCGgAIkyqKliHKsxATXs6mpRVtAtE9zvddmoFx07tzoAou8gzWZ36' +
'9qnSoDw2l5DG5tNMAY4nLnxpGJtW2WnO4VtAeAADQB///////+bF5NUqxLUYdI6CYTF33tZX' +
'3whFW7hN4thD2529v2DAQ7ztd8j3FtSBxs1tVqVn2E7Xkno56/eqqIRrYppTIwNNQWpco+Em' +
'rE80ShC1gASPp//////2rSmQgACBABIFF2U/ueiAP/7UGQGAeJYMc9bJlzCDGAYMQAAAIj0y' +
'T8DYMWAOQBgzACIAPCjGrlLfpFEkgX5gC/9uqbgkIv/BtEg3RVrUveqTcXjGd8a7ap7Gugx6'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Y2IlZh2GumWPLQD//+X///fFGMcONPWv/////V/qBo8sNFQ0T' +
'EFNRTMuOTguMqqqqqqqqqqqqqqqqqr/+xBkC4/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAAN' +
'IAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' +
'qqqqqqqqqqqqqqqqqqqqqqqqg==';
var a = $('<audio>');
a.attr('src', s);
try {
a[0].play();
} catch(e){console.log(e)}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img src="https://i.stack.imgur.com/DkIzu.jpg" width="400"/>

how to start each function from index 1 to post json objects in different div in html

I have this json data
somehow i displayed this part of data in html
and want to display this part of data
into div in html but i am unable to display it using for loop and don't to how to start each function from index 1 as index 0 in personal details data.
here is my code
var url = "http://localhost/ReadExchange/api.php";
$.getJSON(url, function(data) {
if (data) {
alert("hey got the data" + JSON.stringify(data));
var arr = data.length;
//$.each(data, function(i,element) {
var element = data[0];
$("#postjson").append(
'<div id="' + element.id + '">' + '<p>' + 'FirstName:' + element.FirstName + '<br/>'
+ 'MiddleName:' + element.MiddleName + '<br/>' + 'LastName:' + element.LastName + '<br/>' + 'Gender:' + element.Gender + '<br/>' + 'Location:' + element.Location + '<br/>' + 'Email:' + element.Email + '<br/>' + 'Mobile:' + element.Mobile + '<br/>' + '</p>' + '</div>'
);
for (var i = 1; i < arr; i++) {
$("#postjson").append(
'<div id="">' + '<p>' + 'BookTitle:' + data[i].data.BookTitle + '<br/>' + 'BookGenre:' + data[i].data.BookGenre + '<br/>' + 'BookWriter:' + data[i].data.BookWriter + '<br/>' + 'Gender:' + data[i].data.BookDescription + '<br/>'
+ '</p>' + '</div>'
);
}
} else {
return;
}
You can use Array.prototype.splice()
data.splice(0, 1);
then iterate data array at for loop, with i set to 0
var data = [{abc:123}, {def:456}];
data.splice(0, 1);
for (var i = 0; i < data.length; i++) {
alert(JSON.stringify(data))
}

Conference website event schedule behaviour

I am building a conference website with some concurrent sessions in the schedule.
As you can see in the screenshot the seminar 3 is supposed to be concurrent with seminar 1 & 2 but they are separated. Below kindly find the relevant code. Could anyone tell what the reason might be?
Screenshot of Event Schedule in my Website
_addNewContent = function (msg) {
var lastBlock = false;
var lastConcurrent = false;
if (_page == 1) {
_wrapper.html('');
}
$.each(msg.sessions, function (i) {
if (lastBlock) {
var lastTime = lastBlock.find('.schedule__time').text();
lastTime = lastTime.split('-');
if ($.trim(lastTime[0]) == this.time) {
if (!lastConcurrent) {
lastConcurrent = $('<div class="schedule__concurrent"></div>').appendTo(_wrapper);
}
lastConcurrent.append(lastBlock);
} else {
if (lastConcurrent) {
lastConcurrent.append(lastBlock);
lastConcurrent = false;
} else {
_wrapper.append(lastBlock);
}
}
}
var newBlockString = '<div class="schedule__item ' + _dropdown + ' more-content__item">' +
'<time class="schedule__time" datetime="' + this.time + '">' + this.time + ' - ' + this.end_time + '</time>' +
'<h2 class="schedule__event">' + this.post_title + '</h2>' +
'<div class="schedule__details">';
if (_dropdown) {
newBlockString += ' <a class="schedule__close" href="#"><i class="fa fa-times"></i></a>';
}
newBlockString += '<i class="fa fa-location-arrow"></i> ' + this.location + '' +
'<div class="schedule__layout">' +
'<div class="schedule__speakers-group">'; // schedule__speakers-group
$.each(this.speakers, function () {
var speaker_image = '';
if (typeof (this.post_image[0]) !== 'undefined') {
speaker_image = 'background-image: url(' + this.post_image[0] + ')';
}
var favourite = this.featured ? 'speakers-favorite speakers-favorite_small' : '';
newBlockString += '<a href="' + this.url + '" class="schedule__speaker">' + // schedule__speaker
'<div class="schedule__speaker-pic ' + favourite + '" style="' + speaker_image + '">' +
'<span class="schedule__speaker-hover">' + msg.strings.view_profile + '</span>' +
'</div>' +
'<h3 class="schedule__speaker-name">' + this.post_title + '</h3>' +
'</a>'; // /schedule__speaker
});
newBlockString += '</div>' + // /schedule__speakers-group
'<div class="schedule__info">' +
'<div class="schedule__text">' + this.post_excerpt + '</div>' +
'<div class="schedule__labels">';
$.each(this.tracks, function () {
newBlockString += '<span class="label" style="background-color:' + this.color + ';">' +
this.name +
'</span> ';
});
newBlockString += '</div>' +
'' + msg.strings.more_info + '' +
'</div>' + // /schedule__info
'</div>' + // /schedule__layout
'</div>' + // /schedule__details
'</div>'; // /schedule__item
var newBlock = $(newBlockString);
if (msg.sessions.length == 1 || msg.sessions.length == i + 1) {
_wrapper.append(newBlock);
}
lastBlock = newBlock;
});
var newItems = _wrapper.find('.hidden');
setTimeout(function () {
$.each($('.schedule__items'), function () {
new ScheduleOpen($(this));
});
}, 10);
setTimeout(function () {
_heightAnimation(msg.has_items, newItems);
}, 50);
},
I guess your website first read an array of conference sessions before running this whole function.
And I found this part
if (msg.sessions.length == 1 || msg.sessions.length == i + 1) {
_wrapper.append(newBlock);
}
may prevents some of the conference sessions becoming concurrent to the last conference session, especially the last array item.
You can change it to
if (msg.sessions.length == 1) {
_wrapper.append(newBlock);
}
if (msg.sessions.length == i + 1) {
if (lastConcurrent) {
lastConcurrent.append(newBlock);
} else {
_wrapper.append(newBlock);
}
}

I have nested Json data stored in variables how do I access them in another function in jquery?

I am trying to access all my data so that I can append it my html document.
I couldn't reach any of the nested arrays by using evt.locations[i].foo because it would only return the first record.
My goal is to be able to access the variables, I have declared and append them to main_info or secondary_info.
Note: I will obviously be restructuring the number of paragraphs used each time but it is just to see it on the page.
$.each(data.events, function(i, evt) {
//getting all nested records
evt.locations.forEach(function(locations, i, array) {
//location data
var city = evt.locations[i].city;
var state = evt.locations[i].state;
var timeZone = evt.locations[i].timezone;
var contactPhone = evt.locations[i].contactPhone;
var contactEmail = evt.locations[i].contactEmail;
var contactName = evt.locations[i].contactName;
var address1 = evt.locations[i].address1;
var address2 = evt.locations[i].address2;
var postalCode = evt.locations[i].postalCode;
//hosts
var host = evt.locations[i].tags.host;
var specialGuest = evt.locations[i].tags.specialGuest;
var cohost = evt.locations[i].tags.cohost;
//tiers
var tierTitle = evt.locations[i].tiers[i].title;
var tierDecription = evt.locations[i].tiers[i].decription;
var tierPrice = evt.locations[i].tiers[i].price;
var tierRaiser = evt.locations[i].tiers[i].raiser;
var tierMax = evt.locations[i].tiers[i].maxNum;
var tierQuantity = evt.locations[i].tiers[i].quantity;
var shiftStart = evt.locations[i].shifts[i].startDate;
var shiftEnd = evt.locations[i].shifts[i].endDate;
//Creating variables for schema found within locations
console.log(evt.locations[i].city)
//if equal to null/nan/undefined/""
});
var main_info = '<h1>' + evt.name + '</h1>';
main_info += '<p>' + evt.templateInfo.title + '</p>';
main_info += '<p>' + evt.description + '</p>';
main_info += '<p> Date: ' + dateString + " " + timeOfEvent + '</p>';
main_info += '<button class="eventsButton">View Event Details</button>';
// only counts first record
// main_info += '<p class="mainInfo">' + evt.locations[i].city + ','
+ evt.locations[i].state +'</p>';
var secondary_info = '<h1 class="">' + 'hello' + '</h1>';
secondary_info += '<p class="">' + evt.description + '</p>';
secondary_info += '<p class="">' + evt.createdDate + '</p>';
secondary_info += '<p class="">' + evt.createdDate + '</p>';
secondary_info += '<p class="">' + evt.guestsCanInviteOthers + '</p>';
code in JsBin
you already ve a ready to be used object from the http call, why parse it again
$(document).ready(function() {
// Getting all the data from AWS link
$.ajax({
url: 'https://s3.amazonaws.com/interview-api-samples/events-results.json',
cache: false,
dataType: 'json',
type: 'GET',
data: ({
'events': []
}),
success: printEvents,
error: function(e, xhr) {
console.log(e);
}
});
function printEvents(events) {
$.each(events.events, function(i, event) {
//console.log(i, event);
var eventStart = event.startDate;
var myDate = new Date(eventStart);
var dateString = myDate.getUTCMonth() + "/" + ("0" + (myDate.getUTCDate() + 1)).slice(-2) + "/" + ("0" + myDate.getUTCFullYear()).slice(-2);
// Converting time from military to standaerd and checking if it is am/pm
var hours = myDate.getUTCHours();
var minutes = myDate.getUTCMinutes();
var timeOfEvent = "" + ((hours > 12) ? hours - 12 : hours);
timeOfEvent += (minutes < 10) ? ":0" + minutes : ":" + minutes;
timeOfEvent += (hours >= 12) ? " P.M." : " A.M.";
var main_info = '<h1>' + event.name + '</h1>';
main_info += '<p>' + /*event.templateInfo.title*/ "" + '</p>'; //<--- empty
main_info += '<p>' + event.description + '</p>';
main_info += '<p> Date: ' + dateString + " " + timeOfEvent + '</p>';
main_info += '<button class="eventsButton">View Event Details</button>';
console.log(event.locations);
$.each(event.locations, function(i, location) {
// here take what you need es: location.city, location.contactGivenName ....
$.each(Object.keys(location), function(i, loc) {
main_info += '<p class="mainInfo">' + loc + ' , ' + location[loc] + '</p>';
})
$.each(location.tiers, function(i, tier) {
// here take what you need es: tier.id, tier.quantity ....
$.each(Object.keys(tier), function(i, t) {
main_info += '<p class="mainInfo">' + t + ' , ' + tier[t] + '</p>';
})
});
//same here for others nested array elements
});
var secondary_info = '<h1 class="">' + 'hello' + '</h1>';
secondary_info += '<p class="">' + event.description + '</p>';
secondary_info += '<p class="">' + event.createdDate + '</p>';
secondary_info += '<p class="">' + event.createdDate + '</p>';
secondary_info += '<p class="">' + event.guestsCanInviteOthers + '</p>';
$("div.content").append("<div class=event><div class=main_info>" + main_info + "<div class=secondary_info>" + secondary_info + "<input class=attending type=checkbox>" + "I will attend this event" + "</>" + "</div></div></div>");
});
}
console.log("done");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class=content></div>
try:
$(document).ready(function(){
// Getting all the data from AWS link
$.ajax(
{
url: 'https://s3.amazonaws.com/interview-api-samples/events-results.json',
cache: false,
dataType: 'json',
type: 'GET',
data: ({ 'events' : [] }),
success: hillEvents,
error: function(e, xhr)
{
console.log(e);
}
});
function hillEvents(data)
{
$('#hillEvents').html(data.Date);
$.each(data.events, function(i, evt){
// converting date and time.
var eventStart= evt.startDate;
var myDate = new Date(eventStart);
// changing myDate to a date string
var dateString =
myDate.getUTCMonth() +"/"+
("0" + (myDate.getUTCDate()+1)).slice(-2) +"/"+
("0" + myDate.getUTCFullYear()).slice(-2);
// Converting time from military to standaerd and checking if it is am/pm
var hours = myDate.getUTCHours();
var minutes =myDate.getUTCMinutes();
var timeOfEvent = "" + ((hours >12) ? hours - 12 : hours);
timeOfEvent += (minutes < 10) ? ":0" + minutes : ":" + minutes;
timeOfEvent += (hours >= 12) ? " P.M." : " A.M.";
//getting all nested records
$.each(evt.locations,function(i,locations) {
//location data
var city= locations.city;
var state= locations.state;
var timeZone= locations.timezone;
var contactPhone= locations.contactPhone;
var contactEmail= locations.contactEmail;
var contactName= locations.contactName;
var address1= locations.address1;
var address2= locations.address2;
var postalCode= locations.postalCode;
//hosts
var host= locations.tags.host;
var specialGuest=locations.tags.specialGuest;
var cohost=locations.tags.cohost;
$.each(locations.tiers,function(i,v){
var tierTitle= v.title;
var tierDecription= v.decription;
var tierPrice=locations.price;
var tierRaiser=v.raiser;
var tierMax=v.maxNum;
var tierQuantity=v.quantity;
});
$.each(locations.shifts,function(i,v){
var shiftStart= v.startDate;
var shiftEnd= v.endDate;
});
});
var main_info ='<h1>' + evt.name + '</h1>';
main_info += '<p>' + evt.templateInfo.title + '</p>';
main_info += '<p>' + evt.description + '</p>';
main_info += '<p> Date: ' + dateString + " "+ timeOfEvent+ '</p>';
main_info += '<button class="eventsButton">View Event Details</button>';
// only counts first record
// main_info += '<p class="mainInfo">' + locations.city + ','+ locations.state +'</p>';
var secondary_info = '<h1 class="">' + 'hello'+ '</h1>';
secondary_info += '<p class="">' + evt.description + '</p>';
secondary_info += '<p class="">' + evt.createdDate + '</p>';
secondary_info += '<p class="">' + evt.createdDate + '</p>';
secondary_info += '<p class="">' + evt.guestsCanInviteOthers + '</p>';
$("div.content").append("<div class=event><div class=main_info>"+ main_info +"<div class='secondary_info>'"+ secondary_info +"<input class=attending type=checkbox>"+"I will attend this event"+"</>"+"</div></div></div>");
});
}
console.log("done");
});
just declare it out of function and you are able to use that variable in your main_info and secondary_info i.e.:
var city;
var state;
var timeZone;
var contactPhone;
var contactEmail;
var contactName;
var address1;
var address2;
var postalCode;
//hosts
var host;
var specialGuest;
var cohost;
//tiers
var tierTitle;
var tierDecription;
var tierPrice;
var tierRaiser;
var tierMax;
var tierQuantity;
var shiftStart;
var shiftEnd; //getting all nested records
evt.locations.forEach(function(locations, i, array) {
//location data
city= evt.locations[i].city;
state= evt.locations[i].state;
timeZone= evt.locations[i].timezone;
contactPhone= evt.locations[i].contactPhone;
contactEmail= evt.locations[i].contactEmail;
contactName= evt.locations[i].contactName;
address1= evt.locations[i].address1;
address2= evt.locations[i].address2;
postalCode= evt.locations[i].postalCode;
//hosts
host= evt.locations[i].tags.host;
specialGuest=evt.locations[i].tags.specialGuest;
cohost=evt.locations[i].tags.cohost;
//tiers
tierTitle= evt.locations[i].tiers[i].title;
tierDecription= evt.locations[i].tiers[i].decription;
tierPrice=evt.locations[i].tiers[i].price;
tierRaiser=evt.locations[i].tiers[i].raiser;
tierMax=evt.locations[i].tiers[i].maxNum;
tierQuantity=evt.locations[i].tiers[i].quantity;
shiftStart= evt.locations[i].shifts[i].startDate;
shiftEnd= evt.locations[i].shifts[i].endDate;
console.log(evt.locations[i].city)
});

How to return a value from javascript function [duplicate]

This question already has answers here:
How do I return the response from an asynchronous call?
(41 answers)
Closed 9 years ago.
I have the following function from where i want to return the htm value however i am getting an undefined. I get a return value as i have checked that already.
function loadData(uid) {
$.ajax({
type: "POST",
url: '<%= page.resolveURL("~")%>Haggler.asmx/getLovedProductsSellerStoreByFbId',
//url: '<%= Page.ResolveUrl("~")%>Haggler.asmx/GetFacebookFriends',
data: '{FacebookId:' + uid + ',pageIndex:' + JSON.stringify(pageIndex) + '}',
contentType: "application/json; charset=utf-8",
dataType: 'json',
async: true,
// Page parameter to make sure we load new data
success: function (data) {
var myObject = eval('(' + data.d + ')');
//alert('getProductDescription' + JSON.stringify(myObject));
var html = '';
pageIndex++;
var htmlCategoryList = '';
var i = 0, length = myObject.length;
var _productLink = '';
var _productFullLink = '';
if (length > 0) {
pageCount = myObject[0].PageCount;
if (length > 0) {
for (; i < length; i++) {
if (myObject[i].ShippingQuantity > 0) {
_productLink = myObject[i].SellReqID + '/product/' + myObject[i].CurrentNodeName;
_productFullLink = "http://www.xarato.com/" + myObject[i].SellReqID + "/product/" + myObject[i].CurrentNodeName;
if (myObject[i].Discount == 0) {
/**
if (parts[parts.length-1] == 'loves') {
html += '<li class="polaroid"><div class="prodoptionbg prodseller"><span>Listed by ' + myObject[i].FirstName + ' ' + myObject[i].LastName + '</span></div><a href="/' + _productLink + '"><div style="position:relative;"><img alt="' + myObject[i].NodeName + '" src="/' + myObject[i].
html += '<li class="polaroid"><div style="position:relative;"><img alt="' + myObject[i].RequestTitle + '" src="/' + myObject[i].Image1 + '"_thumb.jpg" width="200" height="' + myObject[i].ThumbHeight1 + '"><div class="options"><span class="favs" id="span' + myObject[i].SellReqID + '">' + myObject[i].Likes + '</span><span class="fav" onclick="calculateLike(event,' + myObject[i].SellReqID + ')">like it!</span></div></div><div class="prod"><span>' + myObject[i].RequestTitle + '</span></div><div class="prodprice1"><span style="font-weight:700;">Rs. ' + Math.round(parseFloat(myObject[i].MRPrice) + parseFloat(myObject[i].ShippingPrice)) + '</span></div></li>';
}else{ **/
//alt="' + myObject[i].RequestTitle + '"
html += '<img alt="' + myObject[i].RequestTitle + '" src="/' + myObject[i].Image1 + '_thumb.jpg" width="200" height="' + myObject[i].ThumbHeight1 + '">';
//}
}
else {
/**if (parts[parts.length-1] == 'loves') {
var _finalPrice = parseFloat(myObject[i].MRPrice) - (parseFloat(myObject[i].Discount) * parseFloat(myObject[i].MRPrice))/100
html += '<li class="polaroid"><div class="prodoptionbg prodseller"><span>Listed by ' + myObject[i].FirstName + ' ' + myObject[i].LastName + '</span></div><div style="position:relative;"><img alt="' + myObject[i].NodeName + '" src="/' + myObject[i].Preview + '_thumb.jpg" width="200" height="' + myObject[i].Height + '"><div class="options"><span class="favs" id="span' + myObject[i].NodeId + '">' + myObject[i].Likes + '</span><span class="fav" onclick="calculateLike(event,' + myObject[i].NodeId + ')">like it!</span></div><div class="kjss"><span>' + myObject[i].Discount + '% Off</span></div></div><div class="prod"><span>' + myObject[i].NodeName + '</span></div><div class="prodprice1"><span style="color:#777777; text-decoration:line-through">Rs. ' + myObject[i].MRPrice + '</span> <span style="font-weight:700;">Rs. ' + Math.round(_finalPrice + parseFloat(myObject[i].ShippingPrice)) + '</span></div></li>';
}else{**/
//alt="' + myObject[i].RequestTitle + '"
html += '<img alt="' + myObject[i].RequestTitle + '" src="/' + myObject[i].Image1 + '_thumb.jpg" width="200" height="' + myObject[i].ThumbHeight1 + '">';
//}
}
}
}
if (clearHtml) {
// $('.bxslider').html('');
//htm = '<li>"' + html + '"</li>';
}
// var htmli = '<li>"' + html + '"</li>';
// $('.bxslider').append(htmli);
htm = '<li>' + html + '</li>';
alert(htm);
return htm;
clearHtml = false;
var options = {
autoResize: true, // This will auto-update the layout when the browser window is resized.
container: $('#main'), // Optional, used for some extra CSS styling
offset: 17, // Optional, the distance between grid items
itemWidth: 225 // Optional, the width of a grid item
};
}
else {
return;
}
}
else {
return;
}
},
failure: function (data) {
alert('failture');
},
error: function (data) {
alert(data.responseText);
}
});
}
This is how i am taking the data but i get an undefined value.
HtmlM += loadData(myObject.data[i].uid);
Please help me out.
Change your loadData to
function loadData(uid, delegate) {
///In ajax instead of return use
delegate(htm);
}
then call like that
loadData(myObject.data[i].uid, function(html){ HtmlM += html ;});
Ajax is asynchronous so you cant just return (yes you can do it synchronous but its not right way)

Categories