0

I'm doing an application with electron, where I need to use Ajax to make a request. When I run the application everything inside the ajax operation does not execute it is as if electron would not allow or recognize ajax.

Does anyone have a solution for this?

Thank you!

function comprovaNif(){
  var $ = require('C:\\Users\\autoservei\\Documents\\prova\\jquery-3.1.1.min.js');
    $.ajax({
        url: 'https://aplicatiudev.spinvilanova.com/aplicatiu/lib/dadesJSONFunc.php?call=ciberIniciSessio&nosession=1&numSerie=pcSpin3&nif=' + $("#nif").val(),
        dataType: 'json',
        success: function(data){
          var potAccedir = data.potIniciarSessio;
          var error = data.error;
          alert(potAccedir);
        }
   });
}
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Javi Palacios
  • 121
  • 3
  • 10
  • 1
    Why are you specifying the absolute path of `jquery`? You should ideally include it as a dependency. – CuriousMind Jul 07 '17 at 08:19
  • I've tried it too, But I have the same problem – Javi Palacios Jul 07 '17 at 08:21
  • Include your package.json file in the question. – CuriousMind Jul 07 '17 at 08:28
  • Is this question/answer any help? https://stackoverflow.com/questions/32621988/electron-jquery-is-not-defined – Lewk Jul 07 '17 at 08:45
  • @Lewk I just tried it and I have the same problem. The problem is not because of jQuery because jQuery if I treat it normally the problem is the part of ajax that does not recognize it – Javi Palacios Jul 07 '17 at 10:02
  • @JaviPalacios have you tried the none minified version (just to be safe)? Or is it possible that the ajax request is being processed before importing jquery has finished? – Lewk Jul 07 '17 at 14:04

0 Answers0