converting php variables to javascript.Not working

<?php header(“Content-type: application/javascript”); ?> <!DOCTYPE HTML> <html> <head> </head> <body> <?php $variable=10; ?> <script> var myVar = “<?php echo $variable; ?>”; alert(myVar); </script> </body> </html> this is my source code and it is not working. My concern is converting the php variable as javascript variable..The alert displays the entire line as a string instead of […]

how to schedule task in windows for mvc 3 web applications?

Possible Duplicate: ASP.NET MVC Repeating Task I am developing MVC 3 web application. I want to do background task using task scheduler in Windows. Is it possible to create a schedule for web application in Windows? Thanks in advance

Finding the location of a TD in a table

So let’s say I have a table, and I want to manipulate a specific <td> in it: HTML: <table> <tr><td>1</td> <td>2</td></tr> <tr><td>3</td> <td>4</td></tr> <tr><td id=”hi”>5</td> <td>6</td></tr> </table> Javascript: document.getElementsByTagName(“table”)[0].rows[2].cells[0]; This will help me REACH a specific cell in a table. My question is this: Say I have a specific <td> inside a table: var td […]

Javascript function stringing

Could anyone explain to me why the third alert function is simply not called?, and a possible reading resource in relation to the error. <script type=”text/javascript”> $( document ).ready(function() { myFunction(); }); function myFunction() { alert(“First Function”); mySecondFunction(function () { alert(“Third Function”); }); } function mySecondFunction() { alert(“Second Function”); }

Parse ISO8601 date string to date with UTC Timezone

I am trying to serialize/deserialize a date from/to a javascript application. Server side, I use java, JodaTime is installed on it. I found out how to serialize to ISO with UTC Time zone, but can’t find out how to do the reverse operation. Here is my code public static String getIsoDate( Date date ) { […]

Does jQuery can use an end tag as a selector?

I am pretty new in jQuery. I cam across this jQuery code that uses <div /> as a selector: $(“<div />”).html(someString).text(); First of all, I would like to know if it is a legitimate tag to use, since div has an end tag: </div>. But my main question – does jQuery can use an end […]

How to define array of objects in Sequelize.js?

How can I define an array of objects field in Sequelize.js model? I need something like this { “profiles” : [ { “profile_id”: 10, “profile_pictures” : [“pic1.jpg”,”pic2.jpg”,”pic3.jpg”], “profile_used_id” : 12 }, … // more profiles ] } I checked the docs, but couldn’t find a relevant data type, am I missing something here ?

tofixed() + 2 acting like tofixed + “2”

var number = 1.2; var rounded = number.tofixed() + 2 I’m trying to sum tofixed value with any number but using the code above I was schoked of rounded = 12…. I wonder why it doesn’t sum and how can fix it? Here is fiddle example. Thank you.

passing variable in regular expression in javascript for string match

Suppose i need to use string match in javascript to get a result equivalent to the LIKE operator. WHERE “str1″ LIKE ‘%str2%’; The below match expression works. var str1=”abcd/pqrst”; var str2 = “pqr”; if(str1.match(/^.*pqr.*/)){ //do something}; But i need to pass a variable instead of pqr, something like the below statement.Please help. //Wrong var re […]

Iterating over an array of objects

I want to iterate over an array of objects in order to get the oldest person and the youngest person. How could I get that? It looks like an easy task, but there is no way I can get the ages with simple for each loop. Any ideas? var p = [ { name : […]