JavaScript

122K

Solutions

42K

Contributors

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi experts,

I have a question regard to sending data with PHP curl POST, GET vs jquery or javascript ajax request with post and get. Are there any differences in using one over the other as in securely passing data between client and server? I see most examples were dealing with ajax request by sending data over to the server with either GET or POST and obtain data in json instead of using curl to perform this task.  Thanks!
0
Price Your IT Services for Profit
Price Your IT Services for Profit

Managed service contracts are great - when they're making you money. Yes, you’re getting paid monthly, but is it actually profitable? Learn to calculate your hourly overhead burden so you can master your IT services pricing strategy.

I have a jQuery DataTable with columns added for filtering. I'm trying to figure out how to get the select drop-downs to update to match the visible rows whenever the table is filtered on some other row.
The DataTable is setup like this:
<table id="TrainingSchedule" style="width:95%" >   
    <thead>   
        <tr class="filterrow">
            <th><select class="filterSelect" id="filter_Day_0"></select></th>               
            <th><input class='filterInput' id="filter_Date_1" /></th> 
            <th><input class='filterInput' id="filter_StartTime_2" /></th> 
            <th><input class='filterInput' id="filter_EndTime_3"  /></th>  
            <th><input class='filterInput' id="filter_Title_4" /></th> 
            <th><select  class="filterSelect" id="filter_Location_5"></select</th>
            <th><input class='filterInput' id="filter_Room_6" /></th> 
            <th><input class='filterInput' id="filter_Course_7"   /></th>  
            <th><input class='filterInput' id="filter_CourseNumber_8"  /></th>  
            <th><input class='filterInput' id="filter_SectionNumber_9"  type="text" /></th>  
            <th><select class="filterSelect" id="filter_Instructor_10"></select></th>
            <th><select class="filterSelect"  id="filter_Type_11"></select></th>
            <th><select class="filterSelect" id="filter_Ignore_12"></select></th>             
            <th><input class='filterInput' id="filter_DateAdded_13"  /></th>  
        </tr>      
    

Open in new window

0
Screen-Shot-2019-03-22-at-15.18.32.png
so the image is my message editor which i am using ckeditor to create templates,

this text is wrapped in paragraph tags ,

the text within the curly brackets refers to a property,

so when you insert this template on a users profile those id within the curly brackets displayed their info so in this image first name and last name,

is their s way i can read these id within the curly brackets ? im using php
0
Hi experts,
I am trying to display datatable from a jsonresponse using fetch(url) into react componnet
but form some reason I can not see the table in the page.
Thanks very much in advance
here is my code
(NetworkStatus Component.)
import React, { Component } from "react";
import { Route, Redirect } from "react-router-dom";
import ReactDOM from "react-dom";
import $ from 'jquery';
import "react-table/react-table.css";
import { create } from "domain";
import DataTable from 'datatables.net'
$.DataTable = require('datatables.net');

export class NetworkStatus extends Component {
    state ={ data:[]  }

    createTable = (data) => {
        const tableColumns = [
            {Name:'name',       prop:'name'},
            {Name:'EU_ID',      prop:'eu_id'},
            {Name:'Sensor_Id',  prop:'sensor_id'},
            {Name:'IP_Address', prop:'ip_address'},
            {Name:'Latitute',   prop:'latitute'},
            {Name:'Longitute',  prop:'longitute'},
            {Name:'Type',       prop:'type'},
            {Name:'Last_Coms',  prop:'last_coms'},
            {Name:'Last_Data',  prop:'last_data'},
            {Name:'Last_Purged',  prop:'last_purged'},
        ]
        return (
            <DataTable
        keys="id"
        columns= {tableColumns}
        initialData={data}
        />  
    );
    }


    componentDidMount()  {

        var url = 'http://localhost:5000/Sensors';
        fetch(url)
            .then(response => response.json())
            

Open in new window

0
Refer to attached html file which I learnt from my secure browsing vendor will be used in the proxy server
(this proxy is being pointed to by our IE & Chrome browsers).

We are supposed to do whitelisting/blacklistg in the proxy but it's currently not working (got various invalid
certs & website insecure errors when going thru proxy) though this html somehow seems to be activated/run.

My plan is just to set the proxy to not have any whitelist/blacklist but instead this html will check against a
txt file for a list of whitelisted sites/URLs   &  if the URL/IP address that is going to be loaded is in
c:\folder\readonlyfile_whitelist.txt, allow the user to continue to use IE to load it, otherwise, launch/load it
using the secure browser  (refer to the line in the browser ie  garrison://url_to_be_loaded  ie :
   <a href="garrison:%U[URL/URI]">%U[URL/URI]</a>


I'm probably referring to a similar solution in links below:
  https://stackoverflow.com/questions/1686687/how-can-i-get-the-destination-url-for-the-onbeforeunload-event
  https://stackoverflow.com/questions/5190021/track-the-new-url-being-entered-in-the-browser


The URLs in the c:\folder\readonlyfile_whitelist.txt   may contains wildcards so need the
coding needs to handle this.

Eg: readonlyfile_whitelist.txt  contains the following:

*.trusted.com*
*192.168.*

then when the user is loading the following URLs, it will be treated as a whitelisted url
& allow him to continue in IE:
  …
0
Can window.open (Javascript) be made to load on top of the existing Window, sort of like a lightbox?

If not, can you recommend a "lightbox" that can contain a full html page with a form & form elements?

I know how to do a lightbox that is info only.

Thanks
0
Hi There

I have a client who sells time slots for his his business in many different locations. Up until now there has never been any issues because the customer would have to go to their website to start booking an appointment. It is a WordPress site using the Bookings extension with WooCommerce.

However, they are now going to be working with a Hotel that will be sending them some clients, and we will need to monitor the bookings being made.

Is there software/plugins/scripts that will allow a code to be added to the URL which will follow a button clicked on their website through to a booking being made???

We need some way of tracking any bookings being made which originate from the Hotel website.

regards
0
Does anyone know what language this is? It is embedded within our ERP system. I need to add the word Symptoms above Reason for removal.

begin

IF
   WO_SYMPT_FAUL_ACT['SFA_TYPE'] = 'Symptoms' then 
begin

  Text := 'REASON FOR REMOVAL:';
end
else if
    WO_SYMPT_FAUL_ACT['SFA_TYPE'] = 'Faults' then 
begin

  Text := 'FAULT:';
end 
else if
    WO_SYMPT_FAUL_ACT['SFA_TYPE'] = 'Actions' then 
begin

  Text := 'TESTED WITHIN MFG SPECS:';
end 
else
begin
  Text :=  WO_SYMPT_FAUL_ACT['SFA_TYPE']
end;
end;

Open in new window

code.JPG
symptoms.JPG
0
Hi everybody.
I absolutely need some guidance about Stripe. My problem is that I'm trying to use PaymentIntent as suggested by Stripe itself and I can't understand how to send payment data to Stripe.
Let me explain. I have checkout page:
<?php
require_once 'inc_common.php';
if (!isset($_SESSION['loggedUser'])) {
    header('Location: auth/sign-in.php');
    exit;
}
require __DIR__ . '/vendor/autoload.php';
require_once 'admin/php/db.php';

//this get the cart amount using a custom class
$cartAmount = $cart->calcRawTotal();

\Stripe\Stripe::setApiKey("SECRET_API_KEY");


$intent = \Stripe\PaymentIntent::create([
        "amount" => $cartAmount * 100,
        "currency" => "eur",
        "payment_method_types" => ["card"],
    ]);
?>
<!DOCTYPE html>
<html lang="en">

    <head>

        <?php include 'inc_head.php' ?>

    </head>

    <body id="page-top">

        <?php include 'inc_nav.php' ?>

        <section class="features" id="features">
            <div class="container">
                <div class="section-heading text-center">
                    <h2>Página de pago</h2>
                    <p class="text-muted">Por favor rellena el formulario con tus datos</p>
                    <hr>
                </div>
                <div class="row">
                    <div class="col-lg-12 my-auto">
                        <div id="checkoutForm">    
                            <form action="#" method="post" id="payment-form">
                                <div 

Open in new window

0
HI

I've asked other questions about Javascript,
but I saw that one advice page said that I must get a special eclipse IDE for web development.... but I already have eclipse Kepler. Is that not enough?

...down at Getting Eclipse IDE for JavaScript and Web Developers

here

That's quite a surprise...
Thanks
0
5 Ways Acronis Skyrockets Your Data Protection
5 Ways Acronis Skyrockets Your Data Protection

Risks to data security are risks to business continuity. Businesses need to know what these risks look like – and where they can turn for help.
Check our newest E-Book and learn how you can differentiate your data protection business with advanced cloud solutions Acronis delivers

Dear Experts

We have deployed customized business application which is developed using sugar crm and it is hosted on premises. The data that we store is confidential, we have challenges in achieving certain dashboards and understood from developers that they can deliver those but the server requires internet to fetch the javascript library from google server. The library is fetched on each page load and browser renders the chart. The URL from where the library is fetched is https://www.gstatic.com/charts/loader.js 
The chart we integrated with Sugar CRM only downloads a javascript library on each page loads and does not send any data to any server(According to Google). Please refer to this link: https://developers.google.com/chart/interactive/docs/gallery/combochart#data-policy
Please suggest If we go with this integration will our data is not exposed to google, we do not suspect google but as per our internal policy we should ensure the data is not exposed to external network, please suggest. Thanks in advance.
0
I am trying to access a particular website using a VB.net app and a WebBrowser component in that app.

I want to click a link on the page, which uses JavaScript and failed to do so programatically. It was then that I discovered that even when clicking the link directly with the mouse it does not work. The links work fine in conventional web browsers, but not in the WebBrowser component.

I have no control over the destination website.

The HTML for the link in question is:

<a href="javascript:;" class="ellipsis" onclick="fn_detailView('0095000', '00010', '20190315', '1')">(주)유한양행</a>

Is there a way I can "fix" the WebBrowser component with respect to this website, or can I directly call the JavaScript function specified in the link?
0
it's a bizarre problem the program screen starts shaking resizing slightly it's only happens when screen is shrink slightly
please advise what might be happening here
I have a clock that gets displayed in the lower right-hand corner although I had moved it to the center and it made no difference
I am using the sex State mounted to call the setinterval
function it works great until the screen is modified slightly and then it starts breathing as the right Edge moves to the left and to the right an animated fashion.
right now I'll entertain any possible solution it's weird
 
well I can't show the actualcode. I will try in and create a copy to recreate the problem.
set interval causes update of information that is then displayed
within mustaches. {{ datetimestring}}
it would almost seem like maybe it was due to variable fonts
but but then why is it triggered by resizing with screen eg shrinking the screen or adding a component div or span to screen ?

I will post an example of what I'm talking about when I get a chance
0
Here's my code:

const fs = require("fs");
const path = require("path");

module.exports = class Product {
  constructor(t) {
    this.title = t;
  }

  save() {
    const p = path.join(
      path.dirname(process.mainModule.filename),
      "data",
      "products.json"
    );
    fs.readFile(p, (err, fileContent) => {
      let products = [];
      if (!err) {
        products = JSON.parse(fileContent);
      }
      products.push(this);
      fs.writeFile(p, JSON.stringify(products), err => {
        console.log(err);
      });
    });
  }

  static fetchAll() {
    return products;
  }
};

Open in new window


The error that I'm getting is:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at fs.readFile (C:\wamp\www\adm\node\express_tutorial\models\product.js:18:25)
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
[nodemon] app crashed - waiting for file changes before starting...

This is line #18: products = JSON.parse(fileContent);

Two questions: First of all, what am I missing that would result in the error that I'm getting?

Secondly, what is "18:25?" I'm referring to the actual error message. "18," I'm assuming, is line #18, but what is "25?"

Thanks!
0
Hi,

So, I'm going to use Javascript for my game client. I can do the server in Java, thanks to local legends. I need a listener waiting for user directives on the game window and sending an activity packet for each frame.
It's going to be a platform style multiplayer.
I'm going to treat it like an RTS, UDP over TCP, for fast delivery of info in UDP packets over reliable TCP sends.
Does Javascript block for GameWindow activity? How is it queried?

What should I know? I got it done in Java be4 w Threads
Thanks
0
I have this php code at the beginning of a php script named sels_req_draw.php":

<?php

	echo "entered sels_req_draw<br>";

	error_reporting(E_ERROR);

	ini_set('session.cache_limiter','public');

	session_cache_limiter(false);

	session_start();

	include "db_connect_nb.php";

	if ($_SESSION['ruid'] != "") {

		$qryp = "SELECT * from projects where ruid = " . $_SESSION['ruid'];

		$resp = mysqli_query($link, $qryp);

		//echo "qryp = " . $qryp . "<br>";

		$np = mysqli_num_rows($resp);

	}

	$models = array();

	$qrys = "SELECT * from sels_by_proj where pid = " . $_GET['pid'] . " and ruid = " . $_SESSION['ruid'];

	$ress = mysqli_query($link, $qrys);

	$ns = mysqli_num_rows($ress);

	for ($i = 0; $i < $ns; $i++) {

		$s = mysqli_fetch_array($ress,MYSQLI_ASSOC);

		$qry1 = "SELECT * from selections where selno = " . $s['selno'];

		$resl = mysqli_query($link, $qryl); 

		$lm = mysqli_fetch_array($resl,MYSQLI_ASSOC);

		$models[$i] = $lm['model'];

	}	

	$uniqueModels =  array_unique( $models );

	$nm = count($uniqueModels);

?>	

Open in new window


The echo at the beginning never shows, the page is not displayed.

The Javascript code that goes to this is here:

if (ac == "rd")      {
                  alert ("got into ac = rd");
                  document.st.action = "sels_req_draw.php?pid=" + pid + "&newproj=" + newproj + "&fr=" + fr;
                  alert("action = " + document.st.action);
                  return false;            
            }

When I run it, I get the last echo as this:

action= https://www.lakoshvac.com/devdev/sels_req_draw.php?pid=3512&newproj=&fr=

The browser window still displays the prior page. Nothing happens.

Of course I can send you the full code of both files if needed.

Thanks
0
Greetings!   I'm working on a custom theme for an OpenCart site.  There is currently a function to add to cart used in the Product template that I'd like to use in the favorites section.  I've moved the code to the best of my ability and it works - except that it doesn't seem to be getting the quantity entered.  

So, on the Product page, customer selects the qty and clicks Add to Cart - it works perfect.
On my Favorites page, customer selects the qty and clicks the Cart button - it adds the item to cart with default qty of 1. - Code Below!

I pulled all the javascript from the products template into mine, then removed the parts I didn't think I needed one by one - I do not believe there is any additional javascript on that products page that I need.  

There are however, some additional elements in the javascript code: #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea are all parts of currently deactivated OpenCart features.  These are in place on the Products template and also not receiving values there either.  Just thought it was worth noting since these variables are not in my code.

I'm stuck and do not know what I'm missing.  What can I change to ensure it passes along the correct quantity value to the shopping cart?   Any and all help appreciated!  Please let me know if you need additional information.  Thank you!!


My current Twig file code:
<code>
{{ header }}
<div 

Open in new window

0
I had this question after viewing Textbox Textchanged event doesn't fire....
0
Sharepoint 2013 onprem, FC only

I need to get users in a permission group and also add/delete users in a group.
I'm using the code from
https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/hh185012(v%3Doffice.14)
However, I'm getting "typeerror: B is undefined" which is deep in the create delegate function and I can cipher what the problem is.

Anyone have any luck with using JS to get and edit names in a sharepoint group?
0
Become a Certified Penetration Testing Engineer
LVL 13
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Hi

In my ASP.net web app I use the code further down  to show a message while my code is running after a button click.
I now want to use this when I click a GridView template button. In the event:
    Private Sub GridView1_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GridView1.RowCommand

            If (e.CommandName = "MyButtonDelete") Then

My current code is as follows

                <div class="pleaseWait">Loading... please wait!</div>
            <div>
                        <asp:Button ID="btnSave" runat="server" BackColor="White" Font-Names="Calibri"
                            ForeColor="#003399" Height="29px" Text="Save" Width="217px" OnClientClick="showLoading(); return false;" />

                </div>

<style type="text/css">
            .pleaseWait { width: 50%; height: 100px; background-color: #cccccc; display: none; z-index:999; position:absolute; left:25%; top:10%}
      </style>
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
      <script type="text/javascript">
            //<![CDATA[
          function showLoading() {
              $('.pleaseWait').show();
          }
            //]]>
       </script>
0
Hello, All.

Not sure if this can be done or not.
I am wanting to design a web-based media site, to catalog all my movies in.
And when the link is clicked on for the movie, I would like to have the default media player to launch the movie.

I read, doing this, would work. However, it does not.
<a href="file://J:/Movies/Drama/MovieDrama.mp4">Movie 1999</a>

Open in new window


Any idea's on how to accomplish this?

I will be doing this for my own network users to access, this is NOT something that will be for the World to see.
Just local area network only.

Thanks All.
Wayne
0
I need to submit a form prior to running Ajax to ensure the data is committed to the database when the Ajax command runs, how can I do this.

Originally, I thought I could set the focus on the submit button and click it, but this does not run sequentially and thus the Ajax command seemed to execute prior to the form data being committed.  What is the proper way to handle such a situation (save without closing modal and run next command in the sequence)?
0
Hi E's,
In a part of my project, I have to check if certain images are loaded, different images, but all with the same class, like you can see in this example:
<!DOCTYPE html>
  <html>
    <head>
<meta charset="UTF-8">
      <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <link rel="stylesheet" href="materialize/materialize.css"/>
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    </head>
    <body> 
    <div class="container">
    
    <div class="row center-align">
    <img src="imagem/bw/bw_0200.jpg" alt="visible image">
    </div>
    
    <img class="0" src="imagem/bw/bw_0183.jpg" style="display: none;">
    <img class="0" src="imagem/bw/bw_0272.jpg" style="display: none;">
    <img class="0" src="imagem/bw/bw_0211.jpg" style="display: none;">
    
    </div>
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
      <script src="materialize/materialize.js"></script>     
    </body>
  </html>

Open in new window

To proceed to another stage of the project, I need to know when the images are fully loaded.
I already searched the Internet for a solution and I did not find it, so I've come to ask for help here.
In jQuery or JavaScript, how can I know if images with class "0" have been fully loaded?

The best regards,
JC
0
Okay, I've got to redo a site that another dev made an attempt at. The previous developer used Twentyfifteen theme to create the site with homepage:

http://uadotcom.staging.wpengine.com/new/

I've created a newer version using the Mundana Theme and Gutenberg blocks. I've created a child theme. This new theme is built with Bootstrap and I'm having a difficult time determining how I'd get that menu to do what I need. I don't use Bootstrap. I've done the sticky menu and adding button before with simple javascript. I think the menu on this new site is tied into Bootstrap somehow.

Where would I even begin to start to get what I need. I tried looking for  scripts in the functions file.

Here's the current page I'm working on:

http://sandbox.intrepidrealist.com/user-acquisition/ 

I need the menu to shrink just a little on scroll, NOT disappear as it does, and then when CTA button in the hero banner is scrolled out of view, then I make it visible in the header.

Where do I start? Sorry for the vagueness! I know diddly about Bootstrap...
0
I'm looking for some good learning resources for Json and Java to shorten some tasks.  Also looking for something on Node and Java.  Any suggested books or websites to learn this stuff?  By the way what application does Json and Node have?


Thanks!
0

JavaScript

122K

Solutions

42K

Contributors

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.