jQuery doesn't work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

jQuery doesn't work

Postby Ciberbago » 02. August 2016 15:33

I am using a jquery script but when I open the page in localhost it doesn't do anything.

The script is in a file named: script.js and the code is:

Code: Select all
var inicio=function () {
   $(".cantidad").keyup(function(e){
      
      if($(this).val()!=''){
         if(e.keyCode==13){
            var id=$(this).attr('data-id');
            var precio=$(this).attr('data-precio');
            $(this).parentsUntil('.producto').find('.subtotal').text('Subtotal: '+(precio*cantidad));
         }
      }
   });
}
$(document).on('ready',inicio);


I call it from another file like this:

Code: Select all
<html>
<head><title>Carrito - CiberPC</title>
<link href= "estilos.css" rel="stylesheet" type= "text/css">

[b]<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="script.js"></script>[/b]

</head>
<body>

etc....


Can you help me, guys? Thank you.
Ciberbago
 
Posts: 3
Joined: 02. August 2016 15:28
XAMPP version: 5.6.21
Operating System: Windows 10 Pro

Re: jQuery doesn't work

Postby Altrea » 02. August 2016 15:38

JQuery is running on the clients browser only.
Xampp components don't touch it so it cannot be a XAMPP problem.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: jQuery doesn't work

Postby Ciberbago » 03. August 2016 05:26

Altrea wrote:JQuery is running on the clients browser only.
Xampp components don't touch it so it cannot be a XAMPP problem.


So... What can it be? :c
Ciberbago
 
Posts: 3
Joined: 02. August 2016 15:28
XAMPP version: 5.6.21
Operating System: Windows 10 Pro

Re: jQuery doesn't work

Postby JJ_Tagy » 03. August 2016 11:22

Usually browsers treat localhost as intranet so the settings are different. Perhaps the browser is disabling the cross site script. As Altrea mentioned, this is not an XAMPP issue.
JJ_Tagy
 
Posts: 788
Joined: 30. January 2012 13:44
XAMPP version: 5.5.15
Operating System: Windows 10 Pro x64

Re: jQuery doesn't work

Postby Ciberbago » 03. August 2016 18:58

JJ_Tagy wrote:Usually browsers treat localhost as intranet so the settings are different. Perhaps the browser is disabling the cross site script. As Altrea mentioned, this is not an XAMPP issue.


Then what can I do?
Ciberbago
 
Posts: 3
Joined: 02. August 2016 15:28
XAMPP version: 5.6.21
Operating System: Windows 10 Pro

Re: jQuery doesn't work

Postby Altrea » 03. August 2016 19:00

Debug your script and browser , request, response, etc.
This is the wrong place to teach you how to debug JavaScript scripts on local environments.
We cannot do anything to help you here, sorry.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 151 guests