1

OK, i have this jQuery script using ajax to load a response from a php file, but i want to do is to load maybe two variables from the php script rather than the whole page.

$(document).ready(function() {
 $.ajaxSetup({
    cache: false
 });
$("#object_area").load("test.php");
   var refreshId = setInterval(function() {
      $("#object_area").load("test.php");
   },10000);
});

So what i want is to be able to say load variable1 from the php page into object_area, then load variable2 into object_area2 if that makes sense?

Thanks

2
  • What are these variables? I'm not following here, can you elaborate a bit more, maybe an example? Commented Oct 31, 2010 at 10:43
  • Well, this is just for concept rather than a working example, but say in my php i had: $variable1 = "John Smith"; and $variable2 = "Jack The Lad"; but i wanted to grab $variable1 and stick it in object_area and grab $variable2 and stick it in object_area2 Commented Oct 31, 2010 at 10:48

1 Answer 1

1

What about return your variables in JSON format with the dedicated PHP function ?

(don't forget to properly set the headers)

You could manipulate your variables more simply with JQuery

Sign up to request clarification or add additional context in comments.

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.