tags:

views:

35

answers:

2

Hi i need help with refreshing div, but not auto refresh!

I have my div like this.

<div id="osvezi">
<?php include('moduli/skupina_artiklov/osvezi.php'); ?>
</div>

I want that i clicked some button they refreshed me only div osvezi.

Thanks for help.

+2  A: 

You can use .load() with a selector like this:

$(function() {       //run when the document's ready, elements are loaded
  $("#myButton").click(function() {
    $("#osvezi").load(location.href + " #osvezi > *");
  });
});

This responds to an element with id="mybutton" being clicked and refetches the page but only that portion. Alternatively, if moduli/skupina_artiklov/osvezi.php is accessible directly, you can just load that directly (more efficient!) this:

$(function() {
  $("#myButton").click(function() {
    $("#osvezi").load("moduli/skupina_artiklov/osvezi.php");
  });
});
Nick Craver
ok but i have next problem
Alen
$(function() { //run when the document's ready, elements are loaded $("#myButton").click(function() { $("#osvezi").load(location.href + " #osvezi > *"); });});This refresh me div but i used in my php file sestavljen_artikel.phpa jquery function to feel me another select
Alen
@Alen - I don't follow your question, can you clarify?
Nick Craver
A: 

I have in sestavljen_artikel.php this div osvezi. And in this file i have jquery code that feel me another select.

jquery

function nalozi() { var id_skupine = $('#skupina option:selected').val(); $('#artikel option').remove(); //$('#artikel').append(''+id_skupine+''); $.getJSON('moduli/skupina_artiklov/artikli.php', {id_skupine:$('#skupina').val()}, function(data) { $.each(data, function(index,item) { $("#artikel").append("" + item.ime_artikla + " - " + item.storitev + " (" + item.cena + " €" + ")" + ""); }); }); }

But when they refreshed me div, this function not working and other function.

Alen