javascript

  1. F

    Promise in Promise function: Can't push data into Array

    I am using sequelizeJS. I have a Promise in Promise function. I want to make a Promise function to get data, then push this data into Array and return this Array. I tried with this code but it's not success. function sequelize_conversation (conversation_id, req) { return new Promise((resolve...
  2. S

    How to disable button during ajax request

    So I have a razor form and I want to disable a button during ajax request. Also I want to be able to send only one request to controller - (disable any flood attempt) This is my html: <div class="row"> <div class="col-md-8 col-md-offset-2"> @using...
  3. K

    jQuery live edit table do ajax update and delete, focusout problem

    I want to use jQuery make a table live edit/update/delete , but now has two problems if click the pen by order #3 to #1 , total 3 clicks, but why click the pen by order #1 to #3 total 5 clicks ? click tick icon action won't fire because input box focusout Full code see the demo here...
  4. W

    Passing JSON with functions via AJAX

    Quite simply, I'd like to "re-hydrate" functions which are passed from AJAX, as follows: //AJAX response: {"foo":"bar","baz":"function(){console.log('I am back working as a function!');}"} And obviously, baz should be a function and not a string. How would I do this?
  5. L

    Sending data with XMLHttpRequest

    I have a website that should send a name to a python script (on a third-party website) when a button is pressed. This python script will then make the name uppercase and return it back to the website. Right now an XMLHttpRequest is correctly being sent when the button is pressed, but I'm unsure...
  6. A

    How to set a property true by clicking on a button on carousel in Vuetify

    I have a component for my Carousel: <template> <div class="caro"> <v-carousel > <v-carousel-item v-for="(item,i) in items" :key="i" :src="item.src" > <div class="title"> <v-btn color="error" dark large>{{item.title}}</v-btn> </div>...
  7. B

    Shorthand way of creating html elements from an array of arrays

    Is there a way to make this into something shorter? I have a list of 15 questions and need them to stay in order. after each question is answered it go to a nextQuestion function. I would like to keep that as is. I've tried doing a for loop, but it keeps making the questions come out of order...
  8. F

    How do you put text under Tab header that links with the tab you press?

    I'm new to HTML coding and I want to know how do I put another tab content below the tab header that links to what ever tab I press. I can see the tab content is on top but how do I put the content below the tab too that is linked? P.S. I do not know how to put code below the header how to link...
  9. P

    Webpack JSX cannot resolve relative module through ES6 imports

    I'm setting up webpack for a large already existing React App. Seems to be working fine but some modules causes trouble unless I specifically add the extension to the import //not working import AppRouter from './router'; //working but meh import AppRouter from './router.jsx'; It does not...
  10. P

    How can this code to be more shorter? in input

    How can this code to be more shorter to avoid duplicating? For example, I have insert1 to insert100 function insert1(){ if($("#out_qty1").val() > 0) jQuery("#in_out1").val("in"); else if($("#out_qty1").val() < 0) jQuery("#in_out1").val("out"); } function insert2(){...
  11. K

    Remove every character from a string except the numbers and characters between them

    The problem I'm facing is that I'm unable to get number from a string along with dot or comma between those numbers. Example string: 'kr.2.000,00 DKK' OR '$150.65 USD' OR '€340.00 EUR' From this string I need to fetch '2.000,00' using regex. so basically the regex would be to fetch numbers and...
  12. K

    How to create custom datatype in typescript?

    I have a object like below export const appErrorTemplate = { NO_APP : { template : 'Unable to initialize #{0}()!', code : 'no-app' }, NO_REQ_FOUND : { template : '#{0}() requires \'#{1}\' to process!', code : 'no-required-found' }, MISMATH : {...
  13. D

    My array is not loading pictures to the html [on hold]

    I believe I have this coded correctly, but I'm not getting the image to show up. Here is the array of questions, answers and the image: var questions = [ question:"Where should choking victims place their hands to indicate to others that they need help?", choices:["A: Over the eyes", "B...
  14. I

    Passing Data Between React Classes doesn't work

    I'm trying to pass data between classes and it's not working. The error says: "Cannot read property 'map' of undefined" (I need it to stay a class for a future state). I have tried to use it in a different component (not a Class) and it works. This is my first class: import React, { Component }...
  15. H

    Form inputs in modal not showing as required

    I've read through some related articles without any luck of solving my own issue of getting form fields to appear as required. Perhaps the problem lies outside but I wanted to share in case it highlights a unique case. This is a class assignment viewable in entirety here, it allows the user to...
  16. M

    Change the inner HTML with another HTML code block of a div and a script

    I have been struggling with this so hopefully someone can help! So I am looking to change the inner html of a paragraph to another html element containing a div and script when my frame receives a message from the page code. I have this working only for when the inner html is set to replace with...
  17. E

    How to rearrange divs for single page application

    I'm building a single-page web app. In this one file, I want a specific div to be shown on startup. Perhaps the user will then press a button, and a new div will replace it. Right now, I'm using js to hide one div and show another in this case. The problem is, the new div appears further down...
  18. E

    Send variable to PHP file

    In a WordPress post I'm trying to send data to a PHP file stored in the root folder of my website with this code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"> console.log('hi'); var cen = document.getElementById("centro").value; $.ajax({...
  19. G

    How to make my website avalible on local network

    I'm currently working on my website which is running on nodejs usining expressjs, and everything is working fine. However I want to test my website from other devices, for example from my phone or other computer, which are connected to the same wi-fi. How am I supposed to do it? Thank you in...
  20. B

    How I can use WordPress Media Uploader with Multiple image upload Button

    I'm a beginner in jQuery, Multiple image upload Button implement with WordPress Media Uploader is not working, I need to know how to do the right way. Here's my code: Javascript/jQuery For displaying the media uploader and handling the selected images: jQuery(document).ready( function($){ var...
Top