Jump to content

how to get variable with data using jquery

- - - - -

  • Please log in to reply
3 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Hi guys

how r u?

this is my jquery code

$.ajax({

url: 'page.php',

success: function(data) {


	$('#content').html(data);


}

});


when get data store in #content

i need a variable into my data

for when get data

this variable needed boolean
false or true

if false
show data into #content
else
show data into another ID

please help me

thank you so much

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Do you mean to say that if the result is empty, display another id?
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
I think the data, which the ajax sends back, contains a boolean somewhere and depending on its value a different ID should be filled with the data.

How it's done would depend on how the data looks like tho. The structure: JSON, XML, delimited String, ...?

#4
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
i need data is array

for ex if data is array
data[0] = ...
data[1] = ...

---------- Post added at 12:39 AM ---------- Previous post was at 12:38 AM ----------

my english language is very bad, sorry




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users