Search Results

Search found 23794 results on 952 pages for 'serverside javascript'.

Page 63/952 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Play Framework: Generate PDF from template that uses Javascript for graphing

    - by digiarnie
    I have a template that has some Javascript used to generate graphs in the browser. I would like to use that same template to create a PDF and send as an attachment in an e-mail. In this scenario, there would be no browser/client interaction. I am using the PDF module that is available from the Play website and I have managed to get the PDF rendering to work. The only issue is that the graphs don't show up in the PDF but all other static text does. I'm assuming the graphs aren't appearing in the PDF due to the Javascript not being executed prior to the PDF generation. Does anyone have any ideas on how to get around this problem?

    Read the article

  • scope of variables in JavaScript callback functions

    - by Ethan
    I expected the code below to alert "0" and "1", but it alert "2" twice. I don't the reason. Don't know if it is a problem of jQuery. Also, please help me to edit title and tags of this post if they are inaccurate. <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(function() { for (var i=0; i<2; i++) { $.get('http://www.google.com/', function() { alert(i); }); } }); </script> </head> <body> </body> </html>

    Read the article

  • Javascript function as a parameter to another function?

    - by Alex
    Hello there, I'm learning lots of javascript these days, and one of the things I'm not quite understanding is passing functions as parameters to other functions. I get the concept of doing such things, but I myself can't come up with any situations where this would be ideal? My question is: When do you want to have your javascript functions take another function as a parameter? Why not just assign a variable to that functions return value and pass that variable to the function like so: // Why not do this var foo = doStuff(params); callerFunction(foo); //instead of this callerFunction(doStuff); I'm confused as to why I would ever choose to do things as in my second example. Why would you do this? What are the use cases? Thanks!!

    Read the article

  • [JavaScript] How can I load static configuration information

    - by Goro
    In my code, I use JavaScript for UI and PHP for back end. I also use PHP to store application settings and sometimes my UI code needs to access this information. My configuration file looks something like this (config.php): $resolution_x = 1920; $resolution_y = 1080; etc... When I need to access any of these settings form JavaScript, i simply use to substitute the value directly, but it just doesn't strike me as very robust. Are they any dangers of doing this that I am not aware of? Is there a better way of doing this? Thank you,

    Read the article

  • How to get notification when window closes in Firefox extension?

    - by Yashwant Kumar Sahu
    Hello experts I am making toolbar in Mozilla Firefox. On the click of a button on my toolbar, I am opening a new window which navigates to my HTML Page created by me. On this HTML Page on the click of a button I am doing some work and closing the window. That's all done, now I need my original or parent window's toolbar to get notified when this window is closed. I guess adding event listeners won't work as its all done in new window. Please suggest. Any help is apprectiated

    Read the article

  • Dynamically loading JavaScript synchronously

    - by spoon16
    I'm using the module pattern, one of the things I want to do is dynamically include an external JavaScript file, execute the file, and then use the functions/variables in the file in the return { } of my module. I can't figure out how to do this easily. Are there any standard ways of performing a pseudo synchronous external script load? function myModule() { var tag = document.createElement("script"); tag.type = "text/javascript"; tag.src = "http://some/script.js"; document.getElementsByTagName('head')[0].appendChild(tag); //something should go here to ensure file is loaded before return is executed return { external: externalVariable } }

    Read the article

  • Usercontrol access javascript from a Content's Page's Master Page

    - by Coda
    Hello all I have a problem. I have a masterpage that all of my Content pages inherit from. Within this masterpage I have a script tag pointing to the javascript file folder "~/Scripts/validation.js" On my content pages I use different usercontrols that require the use of many of the functions within the validation.js file however if I dont put the tag and the javascript functions within a contentholder on the contentpage the usercontrols do not see these functions and I get errors like "OnNameValidation" is not defined. Of course I can copy the javscript code into all of the pages but that's 30+ pages and a maintenance nightmare if I find a bug in one of the javscript functions. So the question (if you haven't already figured out from my long dissertation) is how can I declare the script tag with the path to the validation.js file so that contentpages and their usercontrols etc. can access the functions/code. Thanks in advance.

    Read the article

  • JavaScript based diff utility

    - by poke
    I'm looking for a diff equivalent written in JavaScript that only returns/prints relevant lines. I don't want both full text displayed next to each other with the differences highlighted, but just want the actual differences (plus some buffer lines to know where the difference is), similar to the output from the linux diff utility. Does anybody know a javascript function that does this? All differences should be recognized (even changed whitespace). Thanks. edit I have seen jsdifflib but in the example it always shows the full source, so unless there is a way to change the output somehow, it doesn't fully meet my requirements.

    Read the article

  • Executing a jquery effect on demand. Is it possible?

    - by Chocol8
    I was looking the Highlight effect of Jquery's. That effect is really the one i would like to add in my webpage. By looking at the the source code, i noticed that the effect will be reproduced on user's click of the div. $("div").click(function () { $(this).effect("highlight", {}, 3000); }); In my webpage i have an ImageButton <asp:ImageButton ID="btnFavorite" runat="server" ImageUrl="~/Images/Favorite.png"/> I would love to perform the highlight effect to the div, when the user clicks on the image button. Is it possible? UPDATE: If it is possible, could i use something like "OnClientClick=" of the ImageButton, since the imagebutton controls are added dynamically to the webpage?

    Read the article

  • Progressbar: Force element.innerHTML update before javascript sort call

    - by maras
    Hi, what is the best practice for this scenario: 1) User clicks "Sort huge javascript array" 2) Browser shows "Sorting..." through element.innerHTML="Sorting" 3) Browser sorts huge javascript array (100% CPU for several seconds) while displaying "Sorting..." message. 4) Browser shows result. Pseudo code: ... <a href="#" onclick="sortHugeArray();return false">Sort huge array</a> ... function sortHugeArray(){ document.getElementById("progress").innerHTML="Sorting..."; ...do huge sort ... ...render result... document.getElementById("progress").innerHTML=result; } When i do that this way, browser never shows "Sorting...", it freezes browser for several seconds and shows result without noticing user... Thank you for advice.

    Read the article

  • Enable/disable zoom on iPhone safari with Javascript?

    - by msqr
    I have 1 page which has 2 DIV elements which is shown/hidden based on user click on action buttons with javascript, I would like to toggle scaling on action button click. I tried with below javascript and it is changing viewport meta but getting no effect. Any suggestions? Blockquote var ViewPortAllowZoom = 'width=device-width;'; var ViewPortNoZoom = 'width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no;'; function AllowZoom(flag) { if (flag == true) { $('meta[name*=viewport]').attr('content', ViewPortAllowZoom); } else { $('meta[name*=viewport]').attr('content', ViewPortNoZoom); } }

    Read the article

  • how can I declare a value deep in an object tree using variable properties in javascript

    - by joshs
    I am trying to have a javascript object tree behave like a php associative array in the following way. var key1 = 'a'; var key2 = 'b'; var key3 = 'c'; var obj[key1][key2][key3] = 'd'; However, in javascript I believe you need to define each property/object pair individually, forming deeper leaves. Something like: var obj[key1] = {}; var obj[key1][key2] = {}; ... Is there a way to simplify or shorten this script? Thanks

    Read the article

  • Remote Ajax Call in jQuery .click() function doesn't finish before going to next page.

    - by Clint
    I need to send click information on my website to a third party server using ajax (json). I am using jquery and I added the click event to certain links. In the click event I am making a json request to a remote server with the location of the click (heat map) and some other information. The problem is that the ajax function doesn't fire in time before the default link action happens. Setting async to false doesn't seem to work on remote ajax calls. I have tried preventDefault(), but then I don't know how to run the default action after the successful ajax call. Here is what I want to do: $('a').click(submit_click); function submit_click(e,fireAjax){ e.preventDefault(); cd_$.ajax({ url: jsonUrl, //remote server dataType: 'json', data: jsonData, async: false, success: function(reply){ //Run the default action here if I have to disable the default action }, }); } Any suggestions?

    Read the article

  • Setting asp:Image URL using Javascript function

    - by Anil
    Hi all I have a series of asp:ImageButtons and one asp:Image(Big). Clicking on each ImageButton should change the ImageUrl of asp:Image to a new ImageUrl. How can we handle this using one Javascript function. Because I dont wanna code ImageButton_Click for each and every asp:ImageButton. This makes my application run very slow and also pass too many server requests. Any ideas ????How to design one powerful Javascript function. By the way when the user clicks on ImageButton...the ImageUrl that has to be set to asp:Image(Big) is same as that of ImageButton. This might help a bit. Thanks in advance

    Read the article

  • How to capture a click on a link on a temporary layer that is hidden when the focus changes

    - by hstoerr
    We have a layer that appears when a certain text input has the focus and that should dissappear when the input loses the focus. I tried to do it like this: <input type="text" onblur="document.getElementById('hideme').style.display='none'" /> <div id="hideme">Textextext <a href="http://disney.com/">disney</a> text</div> My problem is: when the user clicks on the link link, the browser does not follow this link. It seems the layer disappears before the browser checks where the click goes. What can I do here? One idea would be to watch whether the mouse enters the hideme div and not to close it when the mouse cursor is in there, but this seems way to complicated. Do you have a better idea? By the way: you can try it out very easy by pasting this into the Tryit Editor of w3schools. :-)

    Read the article

  • javascript date.utc problem

    - by Dave
    I'm trying to compare 2 dates using javascript. 1 at the end of the month and 1 at the beginning. I need to compare these 2 dates in seconds so I'm using the Date.UTC javascript function. Here's the code: var d = Date.UTC(2010,5,31,23,59,59); document.write(d); var d2 = Date.UTC(2010,6,1,12,20,11); document.write(d2); The output for is: 1278028799000 1277986811000 This is telling me that 1/6/2010 is less than 5/31/2010 in milliseconds. How is that possible? What am I doing wrong? Thanks for your help.

    Read the article

  • Unable to decode hex values in javascript tooltip

    - by staudk27
    Hi all, I have quite the process that we go through in order to display some e-mail communications in our application. Trying to keep it as general as possible... -We make a request to a service via XML -Get the XML reply string, send the string to a method to encode any invalid characters as follows: public static String convertUTF8(String value) { char[] chars = value.toCharArray(); StringBuffer retVal = new StringBuffer(chars.length); for (int i = 0; i < chars.length; i++) { char c = chars[i]; int chVal = (int)c; if (chVal > Byte.MAX_VALUE) { retVal.append("&#x").append(Integer.toHexString(chVal)).append(";"); } else { retVal.append(c); } } return retVal.toString(); } We then send that result of a string to another method to remove any other invalid characters: public static String removeInvalidCharacters(String inString) { if (inString == null){ return null; } StringBuffer newString = new StringBuffer(); char ch; char c[] = inString.toCharArray(); for (int i = 0; i < c.length; i++) { ch = c[i]; // remove any characters outside the valid UTF-8 range as well as all control characters // except tabs and new lines if ((ch < 0x00FD && ch > 0x001F) || ch == '\t' || ch == '\n' || ch == '\r') { newString.append(ch); } } return newString.toString(); } This string is then "unmarshal'ed" via the SaxParser The object is then sent back to our Display action which generated the response to the calling jsp/javascript to create the page. The issue is some text can contain characters which can't be processed correctly. The following is eventually rendered on the JSP just fine: <PrvwCommTxt>This is a new test. Have a*&amp;#xc7;&amp;#xb4;)&amp;#xa1;.&amp;#xf1;&amp;#xc7;&amp;#xa1;.&amp;#xf1;*&amp;#xc7;&amp;#xb4;)...</PrvwCommTxt> Which shows up as "This is a new test. Have a*Ç´)¡.ñÇ¡." in the browser. -The following shows up in a tooltip while hovering over the above text: <CommDetails>This is a new test. Have a*Ç´)¡.ñÇ¡.ñ*Ç´)¡.ñ*´)(¡.ñÇ(¡.ñÇ* Wonderful Day!</CommDetails> This then shows up incorrectly when rendered in the tooltip javascript with all the HEX values and not being rendered correctly. Any suggestions on how to make the unknown characters show correctly in javascript?

    Read the article

  • JQuery: how to use "delegate" instead of "live"?

    - by JacobD
    I've read countless articles how using the JQuery delegate is much more efficient than using the "live" event. As such, I'm having trouble converting my existing Live code to using Delegate. $("#tabs li:eq(0)").live('click',function(){ //...code }); $('#A > div.listing, #B > div.listing, #C > div.listing').live('mouseover',function(){ // ...code }); When I replace the previous code with what I assume is more efficient delegate code, my page doesn't load. $("#tabs li:eq(0)").delegate('click',function(){ //...code }); $('#A > div.listing, #B > div.listing, #C > div.listing').delegate('mouseover',function(){ // ...code }); Any idea why my delegate code doesn't work? Also, any suggestions on how to make this more efficient? UPDATE: The think part of the problem is that, both "#tabs" and "#A, #B, #C" are't present on the web page at page load. Those attributes are dynamically inserted onto the page with an AJAX call. As such, does that mean I have to use live over delegate?

    Read the article

  • View code inside Javascript file on Rails

    - by SpyrosP
    Hello, previously i had javascript code right in the top of my view and it would work. Then, i learned that you can include the js file using yield and i did just that. I had rails view code inside my javascript code like : $( "#exp-progressbar" ).progressbar({ value: <%= ((@quest.end_time - Time.now).to_i * 100 ) / (@quest.duration * 60) %> }); Now, after i do it with yield, i get an error when i do that in the separate js file. How can i do it now ?

    Read the article

  • addEventListener pass caller as argument

    - by Ryan
    Hi, I have the following code. And my problem is that when clicking, the event is firing but the argument passed is not the correct one. It is passing the last dynamically created row i.e. dataStructure.length value. Anyone knows a solution how to get around this? var table = document.getElementById('output'); for(i =0; i<dataStructure.length; i++){ var row = document.createElement('tr'); row.setAttribute('id', i); var url = dataStructure[i].url; if(document.addEventListener) row.addEventListener('click', function(){handleRowClick(i);}, false); var obj = dataStructure[i]; var cellCount = 0; for(field in obj){ var cell = document.createElement('td'); cell.setAttribute('id', cellCount++); //cell.addEventListener('click', function(){window.open(dataStructureObj.links[i].url);}, false); cell.innerHTML = obj[field]; row.appendChild(cell); } cellCount = 0; table.appendChild(row); } } function handleRowClick(rowClicked){ var rowHTML = rowClicked.innerHTML; var cells = rowHTML.getElementsByTagName('td'); for(cell in cells) { alert(cell.value); } window.open(cells[1].innerHTML); }

    Read the article

  • Doing some stuff right before the user exits the page

    - by Mike
    I have seen some questions here regarding what I want to achieve and have based what I have so far on those answer. But there is a slight misbehavior that is still irritating me. What I have is sort of a recovery feature. Whenever you are typing text, the client sends a sync request to the server every 45 seconds. It does 2 things. First, it extends the lease the client has on the record (only one person may edit at one time) for another 60 seconds. Second, it sends the text typed so far to the server in case the server crashes, internet connection fails, etc. In that case, the next time the user enters our application, the user is notified that something has gone wrong and that some text was recovered. Think of Microsoft or OpenOffice recovery whenever they crash! Of course, if the user leaves the page willingly, the user does not need to be notified and as a result, the recovery is deleted. I do that final request via a beforeunload event. Everything went fine until I was asked to make a final adjustment... The same behavior you have here at stack overflow when you exit the editor... a confirm dialogue. This works so far, BUT, the confirm dialogue is shown twice. Here is the code. The event if (local.sync.autosave_textelement) { window.onbeforeunload = exitConfirm; } The function function exitConfirm() { var local = Core; if (confirm('blub?')) { local.sync.autosave_destroy = true; sync(false); return true; } else { return false; } }; Some problem irrelevant clarifications: Core is a global Object that contains a lot of variables that are used everywhere. sync makes an ajax request. The values are based on the values that the Core.sync object contains. The parameter determines if the call should be async (default) or sync. Edit 1 I did try to separate both things (recovery deletion and user confirmation that is) into beforeunload and unload. The problem there was that unload is a bit too late. The user gets informed that there is a recovery even though it is scheduled to be deleted. If you refresh the page 1 second later, the dialogue disappears as the file was deleted by then.

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >