0

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?

3
  • re-check if the jQuery is included! can't see it here inside the head or body tags!! Commented Sep 27, 2012 at 9:57
  • Check What do you mean by doesn't work ? and also check for js error in web console of browsers. Commented Sep 27, 2012 at 9:58
  • is the other page in a different domain than website.com? Commented Sep 27, 2012 at 9:58

2 Answers 2

1

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>
Sign up to request clarification or add additional context in comments.

1 Comment

It worked, thanks a lot, It seems I have added jquery somewhere in the working page.
0

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);
  }
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.