javascript – Get a specific value of a JSON obtained from a request function (js node)

Hi, well, I'm testing with an API, the json sends it back to me:

  "responseId": "-----",
  "queryResult": {
    "queryText": "como estas",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentText": "Estoy bien!",
    "fulfillmentMessages": (
        "text": {
          "text": (
            "Estoy bien!"
    "intent": {
      "name": "projects/prueba/agent/intents/---",
      "displayName": "Que tal esta?"
    "intentDetectionConfidence": 1,
    "languageCode": "es"

Well, I think it's a json and I want the value of achievement:
I have seen and investigated that I should do this

var texto = json
var obj = JSON.parse(texto);
console.log(obj.fulfillmentText o obj("fulfillmentText"))
me devuelve undefined

How can I get the value of accomplishText?

How to load a JavaScript function while loading the view?

I have a view titled "Program Search". I want to deactivate certain fields based on the javascript function while the page is loading. I have already created a custom.js script. Not sure what the name of the program search display page load function should be?

How to create a javascript function that loads when the visualization page loads?

The URL of my page is: https: // xyzdomain / program-search and I just want to alert "Hello" while this page is loading. I'm new to Drupal – javascript combo. Help ?!

Server-side JavaScript rendering (SSR) from Java

I checked JavaScript server-side rendering (SSR) technologies with a headless browser from a Java application to compare performance against other SSR solutions.

The only technology I've always encountered is Selenium, but it seems to be designed for testing purposes and I haven't seen any references, recommendations, suggestions, or even demos on its use for JavaScript server-side rendering. . This leads me to the conclusion that using Selenium for JavaScript SSR is not a common practice, and therefore it is discouraged, but I have found no references to support neither did this conclusion.

So my questions are:

  • Is there a recommendation against or in favor of the use of selenium for SSR?
  • Is there another Java framework for SSR JavaScript that I overlooked?


We are developing a website in Java for the back-end and Vue.js for the front-end. Vue.js relies on custom tags which are translated into client-side HTML tags (browser) via JavaScript.

This configuration creates a complication with SEO, as Google is not able to crawl heavy JavaScript pages as often as simple HTML pages. It also has accessibility issues because the site does not work with JavaScript disabled.

In order to resolve these issues, the server-side rendering requirement was introduced and we evaluated several alternatives recommended by Google regarding dynamic rendering. My task was to evaluate the alternatives based on Java.

Apache security cookie + javascript for certain files

I have an apache server with many wordpress installations, and I want to secure wp-login.php with a simple javascript cookie solution. I have seen such … | Read the rest of

interop – How to work with javascript promises in clojurescript?

I have a problem with js promises:
I am trying to convert this js code:

stripe.createToken(card).then(function(result) {
    if (result.error) {
      // Inform the customer that there was an error.
      var errorElement = document.getElementById('card-errors');
      errorElement.textContent = result.error.message;
    } else {
      // Send the token to your server.

And I have the following:

     (let (result (

But I get "No ReadPort.take protocol method! Defined for object type: (object promise)"

How can I do the js .then () part in cljs?

javascript – jQuery build json from all entries with map ()

I am trying to iterate over all the entries on the page and create a JSON to send via a publication request to the backend:

function getBody() {
         var blocks = $('.list-group-item').map(function(idx, elem) {

            var inputs = $(elem).find('.block-input').map(function (idi, input) {
               //Probably this part needs to change
               return {
                  ($(input).attr('name')): $(input).val()

            return {
               id: $(elem).data('id'),
               name: $(elem).data('name'),

         var products_json = JSON.stringify(blocks,null,'t');

It works, and here is my result:

        "id": 13,
        "name": "About us",
        "inputs": (
                "title": "How we started"
                "paragraph": "We started 5 years ago in a ..."

I want to recover a single object for all the entries and not an object per entry, how to return a key-value pair to an object with map ()? I want the result to look like this:

        "id": 13,
        "name": "About us",
        "inputs": {
            "title": "How we started"
            "paragraph": "We started 5 years ago in a ..."

javascript – Redirect to another component by passing the ID via the table button in React

I have a process component which must redirect me to another component, this other component will have to receive the process.ID, in order to make the records linked to the process.

I created a method like this, but it gave an error, saying that this method does not exist in this context, how could I do this?

I have been recommended to see stateless and stateless people, but I have not been able to apply it properly.

verProcesso(etapa) {

How i make the painting

renderRows() {
 return> {
  return (

javascript – Import of mocks in react / jest with the ESLint no-mocks-import rule

So I am a little confused by this rule and I hit a wall while trying to fix it. The description says that I should not import any __mocks__ directories manually. Currently, I have this:

import { Breadcrumbs as BreadcrumbsView } from '../../__mocks__'

Which of course leads to this ESLint error. the __mocks__ has directly subdictionaries and a index.js file which exports all the necessary simulations from these sub-jurisdictions.

The model itself is simple:

import React from 'react'

export const Breadcrumbs = (props) => (

If I do this:


const { Breadcrumbs: BreadcrumbsView } = import('../../__mocks__')

Then this rule passes (not even sure it's even the right solution, because I still have __mocks__ in the way), but the rule import/no-commonjs failed since i used require.

If I use import there instead of require I get the following error when I run the test:

Test suite failed to run

Jest encountered an unexpected token

This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

Here's what you can do:
 • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
 • If you need a custom transformation specify a "transform" option in your config.
 • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

You'll find more details and examples of these config options in the docs:


var _ref = import('../../__mocks__'),

SyntaxError: Unexpected token import

  at ScriptTransformer._transformAndBuildScript (../../node_modules/jest-runtime/build/script_transformer.js:403:17)

Could someone explain the solution and what am i doing wrong?

Let me also note that I am using Node version 10.13.0. Maybe this is somehow related.

javascript – Returns an array of json objects obtained from ajax from one function to another function

In the function store forms there is a variable List agreement framework , which gets me an array of JSON objects obtained from the function listUsersXCompany. In this function, I execute an AJAX function, which returns an array of JSON objects. Then I have to return this variable to the function store forms for the treatment.

function listarUsuariosXEmpresa(idEmpresa){
    var listaUsuariosXEmpresa = "";
    var datos = {
        'opcion' : 'listarUsuariosXEmpresa',
        'id_empresa' : idEmpresa
        data : datos,
        success: function(response){
            var data = JSON.parse(response);
            listaUsuariosXEmpresa = data;
            return listaUsuariosXEmpresa;

I want to return the listUsersXCompany which will be an array of objects for the following function:

function almacenarProformas(){
  var listaAcuerdosMarco = listarAcuerdosMarco();
  var codigoLista = "";
  for(var i=0; i

javascript – create folders for each user with multer

// I have a form to download files, in this case I want to download an image, I understand that when configuring the destination path end, if there is not a such folder it is created automatically, in my case i want to create a folder for each user i plan to add your username as name

This is my middleware

// middlewares
   app.use(express.urlencoded({extended: true}));
     secret: 'asd68r7qew5fd13s21va68t79e7q495s6df1w6e87rs45d64rw6e845a168',
     resave: true,
     saveUninitialized: true
   app.use(multer({path: path.join(__dirname, `../public/img/${id_del_usuario}`}))); //aqui esta la configuracion de multer

// I don't think of any idea to do it and it is the first time I use this module, if you can help me, I would appreciate it