简体   繁体   中英

passing value from one html to another using jquery load function

I am stuck in a strange problem. The code I am using is working fine in one page but it is not working for another page. I tried everything I could, I even changed the document header to match the page which is working but none is working for me. And then I created a fresh page and typed only the coding that passing the content, but it didn't work in the new page too. I am totally confused and don't know what to do.

Code:

<head>
<script type="text/javascript">
$(document).ready(function(){
$('#bill2').load('http://website.com/fare.html #bill2')
})
</script>
</head>

<body>
<fieldset id="bill2">
</fieldset>
</body>

This code works in one page and not working in another, please tell me am I missing something?

Try this and let me know --

<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#bill2').load('http://website.com/fare.html#bill2');
});
</script>
</head>

<body>
<fieldset id="bill2">
</fieldset>
</body>

This is not answer but I think i should not write this in comment.

Try this full syntax to fig out error

$("#success").load("xxx.php", function(response, status, xhr) 
{
  if (status == "error") 
  {
    var msg = "Sorry but there was an error: ";
    $("#error").html(msg + xhr.status + " " + xhr.statusText);
  }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM