Error loading an HTML file

Asked

Viewed 79 times

0

Good , some days I asked a question about optimization here , and I got satisfactory answers. I soon came to the conclusion , that the way I was doing my WEB system would cause performance problems , as I was doing all my screens and forms within a single index, the solution I thought was to separate the screens and create an html file for each one, so that this file is only read when the user clicks to open a certain screen. I made a code and it worked, only I’m having an error in the jquery and the error is varying, very strange.

Time I get this mistake: jquery.js:1451 Uncaught TypeError: a.getAttribute is not a function

And then , this:

jquery.js:1451 Uncaught TypeError: undefined is not a function

This is the code

$LAB.script('formularios/prospeccao/prospeccao.js').wait();
$.post('formularios/prospeccao/prospeccao.html', function(html) {
    $('#formulario_geral_prospeccao_id').html(html);
});

Can anyone tell me why this mistake ? Thank you!

  • what type of element is'formulario_geral_prospeccao_id' ?

  • Is a section, there inside it I load the HTML content of my screen.

  • Is there a 'a' variable in your code? I had a problem like this when I was going to select a link and call the method click, I don’t remember the jQuery version, but I solved it using an index, even though the element was selected by id. In your code, it would be something like $('#formulario_geral_prospeccao_id')[0].html(html)

  • I get it. It didn’t work for me that way, because the $('#formulario_geral_prospeccao_id').html(html) is the element that will receive the html content. I noticed something , it seems that the error is varying , I received this error now jquery.js:1451 Uncaught TypeError: undefined is not a function. The funny thing is that when I did everything right on the same index it rolled without any problem.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.