That is really strange. Are you sure? It's not much different, but try
this:
function ajax_test(){
var anc_pv = $('.pv_act').attr("pv");
alert('1 '+anc_pv);
$.ajax({
type: "GET",
url: "ajax_test.php",
dataType: "html",
success: function(data){
alert('2 '+anc_pv);
}
});
};
On Aug 27, 12:12 pm, Kilhom <[email protected]> wrote:
> Hi Karl !
> Here is what i've try :
>
> function ajax_test(){
>
> anc_pv = $('.pv_act').attr("pv");
> alert(anc_pv);
>
> $.ajax({
> type: "GET",
> url: "ajax_test.php",
> data: "",
> dataType: "html",
> success: function(data){
>
> alert(anc_pv); // But it show "undefinided"
> alert(anc_pv);
> }
>
> });
>
> };
>
> Here is what i get :
> First alert : "30" (wich is the right value)
> Second alert : "undefinided"
>
> I've try with or without "var" before anc_pv
>
> Another ideas ? :)
> Thanks for your answers !