hi

i have created a php file which calls a php function and echos the results.

i dont want to display the results i want to use them in a jquery function.

jQuery('body').prepend("<div id='target'></div>");
    gMap.gmap3({
        action: 'init',
        onces: {
            bounds_changed: function() {
                var number = 0;
                jQuery(this).gmap3({
                    action: 'getBounds',
                    callback: function() {
				  ### THIS IS WHERE I WANT THE RESULTS ##
                    }
                });
            }
        }
    },

i have been searching and think i need to use ajax to get the php page

$.ajax({
  url: 'ajax/test.html',
  success: function(data) {
    $('.result').html(data);
    alert('Load was performed.');
  }
});

but how can i use the data whwere i want it?

Tutorial ? It's just code. An explanation would make it a tutorial.

For improvement, you can use json_encode() in your php file, to return a JSON object. If you do, then the split() function is obsolete (a , in your return value would break the data too). Best thing is that it would still work, if you have the need to return a list of records.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.