0

I'm using a template in my website, so when I export from PHP to CSV using Javascript :

window.location ="index.php/exporter_resultats";

I get a CSV file full of html of the whole page, not just the data I need.

Is there a way I can export the content of a specific div of the page, without the header and footer and the rest?

lady_OC
  • 417
  • 1
  • 5
  • 20

1 Answers1

0

You can get the contents of a specific div or element using jquery and then parse that using js. In your html:

<div id="myDiv">I just want this text</div>

In your js:

var divContent = $("#myDiv").html();

This will at least get you the specific conten to parse instead of the entire page.

Hope that helps.

Henkealg
  • 1,466
  • 1
  • 16
  • 19