0

Here is my code :

var t_slide = $("#6_toggle");
t_slide.load("6_toggle/1.html");

Here is 1.html

<script type="text/javascript" src=" URL PATH .. js/view.min.js"></script> 

<a class="view" ... </a>    
<a class="view" ... </a>

It works well when I open 1.html directly but it doesn't when I load it in my div with the load function

Does anyone have a clue?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Vincent Roye
  • 2,751
  • 7
  • 33
  • 53

1 Answers1

1

That's simply because the script url isn't valid anymore as 1.html isn't in the same directory. The script is loaded relatively to the page where it is executed.

Add ../ before your path or make it an absolute one starting with / (if you want your page to work in both cases).

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
  • I have tried 2 things : - I put the js file into 6_toggle and I linkded it in 1.html adding: And I have also tried to link it adding : Nothing works – Vincent Roye Nov 23 '12 at 16:20
  • And isn't your view.js dependant of other resources (jQuery comes to mind...) ? Are you sure you don't have the same problem for those resources ? What's the error in the console ? – Denys Séguret Nov 23 '12 at 16:21
  • The jquery file is linked to my page :( I'm slowly loosing my hair – Vincent Roye Nov 23 '12 at 16:30