Error: You called the draw() method with the wrong type of data rather than a DataTable or DataView

I create a google chart using MYSQL-PHP-JSON-Javascript the code for the chart is here:    <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" src="http...

loading Spinner - always keep in the middle of the screen even while scrolling the page

<div id="Dvloading" style="float: left;">         <i id="loadingSpinner" class="icon-spinner icon-spin blue" style="margin-left: 50%; position:absolute ; margin-top: 25%; z-index: 1000; font-size: 800%;...

Google gtag_report_conversion: how can I use it without reloading my page?

I have the form in the popup. I need to use this script:  function gtag_report_conversion(url) {   var callback = function () {     if (typeof(url) != 'undefined') {         window.location = url;     }   };   gtag('event', 'conve...

Change x value of SVG text from CSS

Is there anyway to change the x value of this text from my stylesheet?  < text class="jqx-chart-axis-text" x="7" y="11" width="50" height="37" cursor="default">70000...

onclick in ASP.NET MVC razor CheckBoxFor not working

I need to assign an onclick event to a CheckBoxFor in ASP.NET MVC razor, but it is never called.  I have something like this, which does not work:  <script type="text/javascript">     function setCompleteStatus() {         alert("se...

Placing Javascript in a HTML file [duplicate]

This question already has answers here:...

Use a function with parameters inside a callback

I've written a function which may take an unknown number of functions as parameters, but can't figure how I can make this work when one or more of the functions take parameters too.  Here is a quick example of what I would like to achieve:  f...

Javascript Programming : Is dot [.] always an operator?

In JavaScript, is the dot . always an operator?  For example:  AnObject.aMethod()   Are there any examples where the dot . is not an operator?...

Javascript replace url segment with regex

I have this url http://retail.domain.co.uk/view_orders/page/6/10?type=completed  I want to replace 6 with 1.  The url segment will be different depending on page, so i can't use a string replace.  var url = location.href.replace(, "1");...

Regular expression for validating month

What is the regular expression for validating a month with the leading zero?  Passes regular expression:     01,02,03,04,05,06,07,08,09,10,11,12   Fails regular expression:  1, 00, 13 and up....

typeof of boolean expression with comparison operator

if (typeof foo !== 'undefined') {     // Now we know that foo is defined, we are good to go. }   The typeof evaluates to true or false based on whether the variable foo is defined or not.  But, say if foo !== 'undefined' evaluates to...

Updating a subfield in a mongoDB document using findOne and save

I'm trying to update a particular subfield in a mongoDB document and have decided to first find the object in question and then save an updated one. For some reason, the save option seems to ignore my changes.  I have one object in my collection,...

HTTP request works with cURL but gets CORS response when made in browser with javascript

When I access the typeform API via browser using $.get or superagent or request or axios, I get the error No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not al...

pjs is undefined (processingjs)

if i use this:  $(document).ready(function() {     pjs = Processing.getInstanceById("EyeCanvas");     console.log(pjs); }   then pjs is always undefined  when i use this:  function test() {     pjs = Processing.getInstanceById("EyeCanvas&...

What are the similarities between jQuery and Prototype? [closed]

What are the similarities between jQuery and Prototype?  For example, they both have selectors, although Prototype's general selector uses $$. They both also have the .hide method.  Is there a good list of the similarities?...

Google+ +1 Button from Flash (or programmatically from JS)

I'm trying to figure out how to allow users to click on a Google+ "+1" button from within Flash.  From reading through the Google+ docs and examining that their script is doing, I don't see a way and was wondering if anyone's solv...

Why wouldn't lodash 'some' function work as expected?

I'm trying to use lodash 2.4.1 in order to know if there's at least one element within an array with true as its value.  So I decided to use lodash some or any function.  This is what my code looks like:  if ( _.some([lineup.reachesMaxForeign...

Please can someone help me understand the exec method for regular expressions?

The best place I have found for the exec method is Eloquent Javascript Chapter 9:  "Regular expressions also have an exec (execute) method that will return null if no match was found and return an object with information about the match otherwise...

Can we have code after location.reload(true)?

I have a function that does a reload from server with:  location.reload(true)   Currently, any code I have after this line is not executed.  I'm curious if there is a way to be able to have more code run after the reload?...

javascript getDay() returns wrong number for a date in america but it returns correct value in india

I was trying to get the week day name using javascript getDay(). I know getDay() method returns the day of the week, like: 0 is sunday, 1 is monday etc.  var d=new Date("2014-05-26"); //this should return 1 so weekname monday. alert(d.getDay(...

Keep div overlay relative to background image regardless of window size

I want to overlay some text over a background image with background-size: cover.  Problem here is how do I keep the overlay div at the same position, relative to the background image, regardless of the window's size?  Here's a fiddle to play...

How to access vue/vuex mapActions methods with similar name while has different namespace?

This works just fine.  created() {   this['shared/getPosts']();   this['posts/getPosts']();  },  methods: {   ...mapActions(['shared/getPosts', 'posts/getPosts']), },   But, I was wondering, is there a way to make belo...

javascript: why need to delete the 0 index of an array

in underscore source code, after applying shift or splice on an array and in case the length of the array is zero :   if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];   any idea why still need to d...

Javascript - Chrome extension - Webrequest - Responsebody

I want to write an extension for Chrome to watch my XHR calls and I found that i have to use webRequest for this.  I want to get the response-body of the request but i never can find how to do this. Is this possible?  // chrome.browserAction.onClicke...

Angular.js Passing error message from service to controller $scope

I am doing a http.post request and I am trying to display error message in case anything goes wrong. I am handling the error message in the service, then passing it to the controller and setting it in the $scope. I do not get any JS errors.... any id...

React Events behavior

I'm trying use React events to access a custom 'value' assigned to a button, but I get different results depending on where I click on the button. I can probably use getDOMNode() or this.state to get the desired result but I'm little...

Scaling image from the center (fabricjs)

I'm trying to scale an image using the centeredScaling: true option when setting up the Image instance. I have Circle object that is a "on" a slider that is supposed to be the scale.  Here's the example: http://jsfiddle.net/hellatan/t...

Bootstrap popup when double click a table row

I'm have a bootstrap pop up box using this code.  <a class="btn btn-default" data-toggle="modal" data-target="#addModal"> test</a>   It is working without having any issue. Now I need to do the same(Appear the...

ReferenceError: module is not defined in jasmine

When i am running SpecRunner.html, I am getting the following error     ReferenceError: module is not defined   My Controller is     angular.module('mymodule', [])   .controller('mycontroller', ['$scope',     function($scope)...

How to make a sticky scrolling effect that stays at the top a little and immediately pops off

Sorry for such a dumb question for you, I've got a list of elements with overflow-y:auto, like this:   I'd like to make them stick for just a little bit when I'm scrolling and pop off when the next one is pushing it from the bottom.  It&#...