0

jQuery issue here.

After calling some ajax, I'm having a problem getting a particular div to reload a php file. The only solution that I've come up with is to completely reload the page, but this is really undesirable, because this function is being used as part of a simple sort page.

So in the below code where it says location.reload() I would much prefer it to say something like $("#mydiv").load("phpfile.php"), so that it just loads the file into the div. This .load() actually does connect to the php file, but for some reason phpfile.php cannot finish the MySQL query it's trying to execute.


So the questions are:

1) Is there an easier way to do this than using .load()?

OR

2) If there isn't, why isn't the php file/MySQL query working properly?

function sorter(event){

	var order = $("#sortable").sortable('toArray');
	
	$.ajax({
	url: "sorter.php",
	async: false,
	data: {'id[]': order},
	complete: (function(data){
		location.reload();
		})
	})
}

Edited by elbeato: n/a

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by elbeato
0

Well, it looks like it was easier to run phpfile.php from sorter.php, and then put the data into #mydiv using $("#mydiv").html(data).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.