Search Results

Search found 7898 results on 316 pages for 'underscore js'.

Page 27/316 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • How to render partial.js in rails 3

    - by julian-mann
    Using rails3 - I have a project with many tasks. I want to use javascript to build the UI for each task. I figured I could display those tasks on the projects show page by rendering a javascript partial for each. I can't get 'tasks/show' to see tasks/show.js.erb Any ideas? In projects/show.html.erb <div id="tasks"> <%= render(:partial => "tasks/show", :collection => @project.tasks) %> </div> tasks/show.js.erb $("tasks").append(new TaskWidget(task.id)) I get the errors ActionView::MissingTemplate in Projects#show Missing partial tasks/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths .... around line #13 Thanks

    Read the article

  • Good code highlighting, syntax analysis and code assist editor on js.erb and css.erb files

    - by Pickachu
    I want to know if there is a good compatible api that supports erb and javascript highlighting. I've already tried Eclipse with Aptana RadRails. Perhaps I'm configuring something wrong, but it guesses that I'm using html.erb on both css.erb and js.erb files. I've tried too the Emacs with js2-mode, nXhtml and Rinari modes. Again, it works fine for html.erb, but it detects the css.erb and js.erb as html.erb files. Maybe it's possible to configure it to accept that files and be compatible.

    Read the article

  • Drupal adding JS

    - by Andrew
    I know this is not a Drupal forum but this forum is quick at responding so I thought I should give it a shot. Here's my problem. I'm trying to insert reference to the javascript file in the header by using drupal_add_js function. I placed this line inside template preprocess function of template.php. The result....is not working at all. There is no script link in output as it should be. Can anyone tell me what am I doing wrong? Drupal Version - 6x function phptemplate_preprocess_page(&$vars) { $url = drupal_get_path("theme","mysite"); drupal_add_js($url."/jquery.js"); drupal_add_js($url."/drupal.js"); .....

    Read the article

  • SharePoint Lookup Field 20 Item JS error

    - by Chops
    Hi Everyone, I've got an issue with SharePoint Server 2007 SP1 which seems to be documented in various forms, but I haven't been able to find an answer to my seemingly simpler question. http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/040533d2-c738-4ac2-b2d6-65a1602fa2d1 Essentially, we have a form with a lookup field to another SharePoint list. The lookup field has more than 20 items, and so SharePoint changes the type/behaviour of the field as per the standard behaviour. However, with my custom skin applied, clicking on this drop down causes a JS error from within the Core.js file, as described here: http://splitnut.blogspot.com/2009/06/lookup-fields-in-moss-javascript-error.html What I haven't been able to figure out is why this is only an issue when my custom master page is applied, and not the OOTB master pages. I've been through and tried to see what might cause this, but haven't been able to track down the cause of the behaviour. Any help would be much appreciated. Many thanks.

    Read the article

  • Multiple JS effects on one event

    - by Cylindric
    I've got a bunch of Ajax links in a menu that reload a div called #ajaxupdatediv. I want to display another div while that's loading the new content, so how would I fire off both effects? <div id="#ajaxupdatediv"> Content will go here </div> <div id="ajaxloadingdiv"> ...Loading... </div> Here's a bit of the PHP array( 'update' => '#ajaxupdatediv', 'before' => $this->Js->get('#ajaxupdatediv')->effect('fadeOut'), 'complete' => $this->Js->get('#ajaxupdatediv')->effect('fadeIn'), )

    Read the article

  • Getting started with Express - Error: Cannot find module './routes'

    - by Enrico Tuttobene
    I am just getting started in the world of Node.JS, and I tried using the command line "express" command to install a basic application (with jade support) Now, I was playing around with it a bit to see how it works and I am coming across a strange error: In the /routes directory there is a file called index which contains exports.index = function(req, res){ res.render('index', { title: "Express" }); }; that, as you all know, renders the index page. Well, all I did was renaming that file from index.js to router.js, so that I can easily refer to it as I would like to have more than just an index page. The renaming doesn't work, I get the error Error: Cannot find module './routes' Which is weird, as I though that var express = require('express'), routes = require('./routes'); would require ALL the files in the directory. There must be something small there I'm missing, and please bare with me as I am pretty new to this. Thanks in advance.

    Read the article

  • Issue with javascript array object

    - by ezhil
    I have the below JSON response. I am using $.getJSON method to loads JSON data and using callback function to do some manipulation by checking whether it is array as below. { "r": [{ "IsDefault": false, "re": { "Name": "Depo" }, "Valid": "Oct8, 2013", "Clg": [{ "Name": "james", "Rate": 0.05 }, { "Name": "Jack", "Rate": 0.55 }, { "Name": "Mcd", "Rate": 0.01, }], }, { "IsDefault": false, "re": { "Name": "Depo" }, "Valid": "Oct8, 2013", "Clg": [{ "Name": "james", "Rate": 0.05 }, { "Name": "Jack", "Rate": 0.55 }, { "Name": "Mcd", "Rate": 0.01, }], }, { "IsDefault": false, "re": { "Name": "Depo" }, "Valid": "Oct8, 2013", "Clg": [{ "Name": "james", "Rate": 0.05 }, { "Name": "Jack", "Rate": 0.55 }, { "Name": "Mcd", "Rate": 0.01, }], }] } I am passing the json responses on both loadFromJson1 and loadFromJson2 function as "input" as parameter as below. var tablesResult = loadFromJson1(resultstest.r[0].Clg); loadFromJson1 = function (input) { if (_.isArray(input)) { alert("loadFromJson1: Inside array function"); var collection = new CompeCollection(); _.each(input, function (modelData) { collection.add(loadFromJson1(modelData)); }); return collection; } return new CompeModel({ compeRates: loadFromJson2(input), compName: input.Name }); }; loadFromJson2 = function (input) // here is the problem, the 'input' is not an array object so it is not going to IF condition of the isArray method. { if (_.isArray(input)) { alert("loadFromJson2: Inside array function"); //alert is not coming here though it is an array var rcollect = new rateCollection(); _.each(input, function (modelData) { rcollect.add(modelData); }); return rcollect; } }; The above code i am passing json responses for both loadFromJson1 and loadFromJson2 function as "input". isArray is getting true on only loadFromJson1 function and giving alert inside the if condition but not coming in loadFromJson2 function though i am passing the same parameter. can anyone tell me why loadFromJson2 function is not getting the alert inside if condition though i pass array object?

    Read the article

  • How to Pass a JS Variable to a PHP Variable

    - by dmullins
    Hello: I am working on a web application that currently provides a list of documents in a MySql database. Each document in the list has an onclick event that is suppose to open the specific document, however I am unable to do this. My list gets popluated using Ajax. Here is the code excerpt (JS): function stateChanged() { if (xmlhttp.readyState==4) { //All documents// document.getElementById("screenRef").innerHTML="<font id='maintxt'; name='title'; onclick='fileopen()'; color='#666666';>" + xmlhttp.responseText + "</font>"; } } } The onclick=fileopen event above triggers the next code excerpt, which downloads the file (JS): function stateChanged() { if (xmlhttp.readyState==4) { //Open file var elemIF = document.createElement("iframe"); elemIF.src = url; elemIF.style.display = "none"; document.body.appendChild(elemIF); } } } Lastly, the openfile onclick event triggers the following php code to find the file for downloading (php): $con = mysql_connect("localhost", "root", "password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Documents", $con); $query = mysql_query("SELECT name, type, size, content FROM upload WHERE name = NEED JS VARIABLE HERE"); $row = mysql_fetch_array($query); header ("Content-type: ". $row['type']); header ("Content-length: ". $row['size']); header ("Content-Disposition: attachement; filename=". $row['name']); echo $row['content']; This code works well, for downloading a file. If I omit the WHERE portion of the Sql query, the onclick event will download the first file. Somehow, I need to get the screenRef element text and change it into a variable that my php file can read. Does anyone know how to do this? Also, without any page refreshes. I really appreciate everyone's feedback and thank you in advance. DFM

    Read the article

  • Checking for Value in JS Object

    - by pagewil
    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.

    Read the article

  • JS Url GET vars - problem with encoding

    - by Martin
    Hey there! I'm having a bit of trouble here and I was hoping someone throws me a hint :) I'm getting some GET VARS with JS but I have trouble with non-latin charsets: cyrillic for example. The cyrillic var appears correct in the url but when I retrieve it with JS I get some dummy string. I was wondering of a function similar to "unescape" for such a case. Alternatively, if someone knows a way I could convert a cyrillic string to the same dummy string I get from the URL, it will still do me the trick, since all I need is compare. :) Thanks! Martin

    Read the article

  • SpineJS and RequireJS

    - by ot3m3m
    I am using require.js 2.0. I have the following code that is called initially by require: app.js requirejs.config({ paths: { app: '..', spine: 'spine_src/spine', cs: "cs", }, shim: { 'spine_src/route': { deps: ['spine'] } } }); // Start the main app logic. requirejs(['cs!app/StartApp_Admin', 'spine','spine_src/route'], function (StartApp_Admin, Spine, Route) { { new StartApp_Admin(); } }); And the following controller: StartApp_Admin define () -> class StartApp_Admin extends Spine.Controller constructor: -> @routes "/twitter/:id": (params) -> console.log("/users/", params.id) Spine.Route.setup() When I execute the application I get the following error in my spine route library file (route.js). The application breaks when I call Spine.Route.setup() Uncaught TypeError: Object function (element) {return element;} has no method 'extend' Any help would be greatly appreciated

    Read the article

  • Parsing XML with nodes containing underscores.

    - by alvincrespo
    How do I parse an XML document that contains nodes where underscores exist? <some_xml> <child_node> <child width_info="" height_info="" /> </childnode> </some_xml> I tried this: for each (var item:XML in Environment._XMLData.some_xml.child_node.child){ trace(child.@width_info); } But that does'nt seem to work. I can't change the XML either because its from a third party. Any help would be great. Thanks in advance!

    Read the article

  • SEO difference between dash and hypen

    - by FFish
    I understand with dashes once can search for keywords in different order. What if my keyword has a space in it like real estate or New York Should I use underscores in this case? If I do a Google search for New_York Google hints me: Did you mean: New York There is clearly a difference. Even capitals seems to make a difference, looking at the search results..

    Read the article

  • whJavaScript: how to create a JS event that requires 2 seperate JS files to be loaded first while d

    - by Teddyk
    I want to perform asynchronous JavaScript downloads of two files that have dependencies attached to them. function addScript(url) { var script = document.createElement('script'); script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } addScript('http://google.com/gmaps.js'); addScript('http://jquery.com/jquery.js'); function requiresJQuery() { ... } function requiresGmaps() { ... } function requiresBothJQueryGmaps() { ... } // do some work that has no dependencies on either JQuery or Google maps ... // now call a function that requires Gmaps to be loaded if (GmapsIsLoaded) { requiresGmaps(); } // then do something that requires both JQuery & Gmaps (or wait until they are loaded) if (JQueryAndGmapsIsLoaded) { requiresBothJQueryGmaps(); } Question: How can I create an event to indicate when: JQuery is loaded? Google Maps is loaded JQuery & Google Maps are both loaded?

    Read the article

  • Is it hacky to manually construct JSON and manually handle GET, POST instead of using a proper RESTful API for AJAX functionality?

    - by kliao
    I started building a Django app, but this probably applies to other frameworks as well. In Backbone.js methods that call the server (fetch(), create(), destroy(), etc.), should you be using a proper RESTful API such as one provided by Tastypie or Django-Piston? I've founded it easier and more flexible to just construct the JSON in my Django Views, which are mapped to some URLs that Backbone.js can use. Then again, I'm probably not leveraging Tastypie/Django-Piston functionality to the fullest. I'm not ready to make a full-fledged RESTful API for my app yet. I simply would like to use some of the AJAXy functionality that Backbone.js supports. Pros/Cons of doing this?

    Read the article

  • Set a js variable in a html include

    - by user102533
    I have a ASP.NET page that uses the include method for header. I am adding a JS variable that I access from JS functions In head.htm <script language="javascript" type="text/javascript"> var render=<%= RenderProperty %>; </script> The RenderProperty is a method in the base page class (a .cs file that inherits from System.Web.UI.Page) It looks something like this: private bool _renderProp = false; public bool RenderProperty { get { return _renderProp; } set { _renderProp = value; } } On a page by page basis, I set the RenderProperty in the Page_Load of a aspx page protected void Page_Load(object sender, EventArgs e) { RenderProperty = true; } I get a compile time error that says: The name 'RenderProperty' does not exist in the current context C:\...\head.htm

    Read the article

  • Implicit vs explicit getters/setters in AS3, which to use and why?

    - by James
    Since the advent of AS3 I have been working like this: private var loggy:String; public function getLoggy ():String { return loggy; } public function setLoggy ( loggy:String ):void { // checking to make sure loggy's new value is kosher etc... this.loggy = loggy; } and have avoided working like this: private var _loggy:String; public function get loggy ():String { return loggy; } public function set loggy ( loggy:String ):void { // checking to make sure loggy's new value is kosher etc... this.loggy = loggy; } I have avoided using AS3's implicit getters/setters partly so that I can just start typing "get.." and content assist will give me a list of all my getters, and likewise for my setters. I also dislike underscores in my code which turned me off the implicit route. Another reason is that I prefer the feel of this: whateverObject.setLoggy( "loggy's awesome new value!" ); to this: whateverObject.loggy = "loggy's awesome new value!"; I feel that the former better reflects what is actually happening in the code. I am calling functions, not setting values directly. After installing Flash Builder and the great new plugin SourceMate ( which helps to get some of the useful features that FDT is famous into FB ) I realized that when I use SourceMate's "generate getters and setters" feature it automatically sets my code up using the implicit route: private var _loggy:String; public function get loggy ():String { return loggy; } public function set loggy ( loggy:String ):void { // do whatever is needed to check to make sure loggy is an acceptable value this.loggy = loggy; } I figure that these SourceMate people must know what they are doing or they wouldn't be writing workflow enhancement plugins for coding in AS3, so now I am questioning my ways. So my question to you is: Can anyone give me a good reason why I should give up my explicit g/s ways, start using the implicit technique, and embrace those stinky little _underscores for my private vars? Or back me up in my reasons for doing things the way that I do?

    Read the article

  • Minifying CSS, JS, and HTML - together

    - by Radu
    Minifying JS and CSS is quite common. The benefits of minifying JS are much greater that those seen with CSS because with CSS you can't rename elements - and same goes for HTML. But what if all 3 were minified together so that the benefits of using shorter names can be brought to CSS and HTML? That is, instead of minifying without any regard to the relationships between the 3, these could be preserved and made simpler. I imagine that the implementation could be quite difficult but if it were possible, do you think it would provide a significant advantage over traditional minification?

    Read the article

  • Are Ext JS files necessary in a working site?

    - by songdogtech
    I've inherited a high-traffic site that loads some Ext javascript files and I'm trying to trim some bandwidth usage. Are Ext libraries necessary for development only or are they required for the finished site (I've never used Ext.) The site loads ext-base.js, ext-all-debug.js, expander.js, exteditor.js. It appears that expander.js and exteditor.js have some site specific code, so they should stay? But what about ext-base.js and ext-all-debug.js? Am I reading this correctly - are base and debugging libraries necessary for a live site?

    Read the article

  • Images with razor asp.net mvc inside JS

    - by sarsnake
    I need to dynamically insert an image in my JS code. In my Razor template I have: @section Includes { <script type="text/javascript"> var imgPath = "@Url.Content("~/Content/img/")"; alert(imgPath); </script> } Then in my JS I have: insertImg = ""; if (response[i].someFlag == 'Y') { insertImg = "<img src=\"" + imgPath + "/imgToInsert.gif\" width=\"6px\" height=\"10px\" />"; } But it doesn't work - it will not find the image. The image is stored in /Content/img folder... What am I doing wrong?

    Read the article

  • Always require a plugin to be loaded

    - by axon
    I am writing an application with RequireJS and Knockout JS. The application includes an extension to knockout that adds ko.protectedObservable to the main knockout object. I would like this to always be available on the require'd knockout object, and not only when I specify it in the dependencies. I could concat the files together, but that seems that it should be unnecessary. Additionally, I can put knockout-protectedObservable as a dependency for knockout in the requirejs shim configuration, but that just leads to a circular dependency and it all fails to load. Edit: I've solved me issue, but seems hacky, is there a better way? -- Main.html <script type="text/javascript" src="require.js"></script> <script type="text/javascript"> require(['knockout'], function(ko) { require(['knockout-protectedObservable']); }); </script> -- knockout-protectedObservable.js define(['knockout'], function(ko) { ko.protectedObservable = { ... }; });

    Read the article

  • form_for [@parent,@son],:remote=>true not asking for JS

    - by Cibernox
    Hi. I have a plain old form. That form is used to create new objects of a nested model. #restaurant.rb has_many :courses #courses.rb belongs_to :restaurant #routes.rb resources :restaurants do resources :courses end In my views(in haml), i have that code: %li.course{'data-random'=>random} = form_for([restaurant,course], :remote=>true) do |f| .name= f.text_field :name, :placeholder=>'Name here' .cat= f.hidden_field :category .price= f.text_field :price,:placeholder=>'Price here' .save = hidden_field_tag :random,random = f.submit "Save" I espected that form to be answered by action create of courses_controller with JS (create.js.erb), but it is submited like a normal form, and is answered with html. What am I doing wrong? This problem is similar to this but the only answer don't make sense to me. Thanks Inside

    Read the article

  • How can I set breakpoints in an external JS script in Firebug

    - by Manu
    I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing extarnal JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this w/o having to 'explore' my way into the script? @Jason: This is a good point, but in my case I do not have easy access to the script. I am specifically talking about the client scripts which are invoked by the ASP.Net Validators that I would like to debug. I can access them during a debug session through entering the function calls, but I could not find a way to access them directly.

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >