0

Please guys is there a way i can make a value of the submit button to be loaded automatically from another page using the jquery .load function:

<input type="submit" id="submit" value="(JQUERY LOADED PAGE VALUE HERE)" />

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
        $(document).ready(function() {
            setInterval(function () {
                $('#submit').load('page.php')
            }, 500);
        });
<script>
1
  • What is the result from page.php? Commented Apr 4, 2016 at 13:07

2 Answers 2

1

Change it to a .get() and use the call back

$.get('page.php', function(data) { $('#submit').val(data); });
Sign up to request clarification or add additional context in comments.

Comments

0

You can use normal ajax for this. .load() is supposed to load HTML content.

<input type="submit" id="submit" value="(JQUERY LOADED PAGE VALUE HERE)" />

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
        $(document).ready(function() {
            setInterval(function () {
                $.ajax({
                    url : 'page.php',
                    success : function(data){
                        $('#submit').val($.trim(data));
                    }
                });
            }, 500);
        });
<script>

Comments

Your Answer

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