[jQuery] Charset in $.ajax

2009-04-27 Thread Colonel

Is there way to change charset when I request page by $.ajax?


[jQuery] Re: Using jQuery in requested file by $.ajax

2009-04-26 Thread Colonel

Anybody?

On 26 апр, 03:37, Colonel tcolo...@gmail.com wrote:
 Is it possible ti use jQuery or JS in file which I get by $.ajax?

 For example, I have a file like this file.php:
 ?
  div id=my_div_1pSome text .../p/div
  div id=my_div_2pSome text .../p/div
  div id=my_div_3pSome text .../p/div
  
  script type=text/javascript/script - use JS ???
  
  $(my_container).html(Some text ...); - use jQuery ???
 ?

 And I use $.ajax from main_file.php:
 $.ajax({
  type: POST,
  dataType: html,
  data: data= + $(#container).html(),
  url: file.php,
  cache: false,
  error:  function(msg) {alert(Error Saved:  + msg);},
  success: function(msg) {alert(container =  + $(#container).html
 ());},
  complete: function() {$.unblockUI();}

 });


[jQuery] jQuery installed

2009-04-25 Thread Colonel

How I can check that jQuery is installed (worked)?

Another words check the string script type=text/javascript
src=jquery.js/script in header section.


[jQuery] Using jQuery in requested file by $.ajax

2009-04-25 Thread Colonel

Is it possible ti use jQuery or JS in file which I get by $.ajax?

For example, I have a file like this file.php:
?
 div id=my_div_1pSome text .../p/div
 div id=my_div_2pSome text .../p/div
 div id=my_div_3pSome text .../p/div
 
 script type=text/javascript/script - use JS ???
 
 $(my_container).html(Some text ...); - use jQuery ???
?

And I use $.ajax from main_file.php:
$.ajax({
 type: POST,
 dataType: html,
 data: data= + $(#container).html(),
 url: file.php,
 cache: false,
 error:  function(msg) {alert(Error Saved:  + msg);},
 success: function(msg) {alert(container =  + $(#container).html
());},
 complete: function() {$.unblockUI();}
});


[jQuery] Re: Alternate $.load

2009-04-23 Thread Colonel

This isn't entirely correct, and not quite what I had. For example I
have a lots of divs in temp.php (after work with DB). And in the end
of $.ajax I have msg. How I can manipulate with this and find divs and
p and so on ?

On 23 апр, 05:08, Shane Riley shanerileydoti...@gmail.com wrote:
 Typically you'd only echo the data back that you want instead of
 having to weed through a string of HTML data to extract what you need.
 From what it looks like, you're needing a specific element from
 another page while still being able to access the other page
 (temp.php) in its entirety. The easiest solution in this case would be
 to send some data to temp.php letting it know that you're initializing
 an asynchronous request, and then have the PHP return only what you're
 looking for. A quick solution in this case would be something like
 this:

 $.ajax({url: 'temp.php',
             data: ajax=true,
             cache: false,
             error:  function(msg) {alert(Error Saved:  + msg);},
             success: function(msg) {alert(Data Saved:  + msg);},
             complete: function() {$.unblockUI();}
            });
 Then in temp.php, check for this flag, and if it's true, send the
 header2 div only.

 ?php
 $header2 = 'div id=header2pSome text in header2 .../p/div';
 if ($_GET[ajax])
 { ?
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
  titleTest file/title
  meta http-equiv=Content-Type content=text/html;
 charset=windows-1251
 /head
 body
  div id=headerpSome text in div header/p/div
  ?
  $id = isset($_GET[ID]) ? $_GET[ID] : ;
  $number = isset($_GET[NUMBER]) ? $_GET[LOT_NUMBER] : ;
  echo pbid =/b . $id . /p;
  echo pnumber =  . $number . /p;
 echo $header2;
  ?
 /body
 /html
 ?php } else { echo $header2; } ?

 However ideally you'd use a separate PHP function or file altogether
 to handle it.

 On Apr 22, 8:21 pm, Colonel tcolo...@gmail.com wrote:

  I know it. But how I can get content from remote file by $.ajax?
  For example I have some file temp.php:

  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
   titleTest file/title
   meta http-equiv=Content-Type content=text/html;
  charset=windows-1251
  /head
  body
   div id=headerpSome text in div header/p/div
   ?
   $id = isset($_GET[ID]) ? $_GET[ID] : ;
   $number = isset($_GET[NUMBER]) ? $_GET[LOT_NUMBER] : ;
   echo pbid =/b . $id . /p;
   echo pnumber =  . $number . /p;
   ?
  div id=header2pSome text in header2 .../p/div
  /body
  /html

  and Am using $.ajax:

  $.ajax({url: 'temp.php',
              cache: false,
              error:  function(msg) {alert(Error Saved:  + msg);},
              success: function(msg) {alert(Data Saved:  + msg);},
              complete: function() {$.unblockUI();}
             });

  how I can get for example content only from div with id=header2 ?

  On 23 апр, 01:55, Shane Riley shanerileydoti...@gmail.com wrote:

   You can use a number of Ajax functions built in to JQuery depending on
   your specific needs. Check them out athttp://docs.jquery.com/Ajax. If
   all you're looking to do is insert one file into another, load is
   normally the way to go, unless you're looking to place the loaded file
   before, after, or in between elements rather than inside a placeholder
   element.

   On Apr 22, 5:50 pm, Colonel tcolo...@gmail.com wrote:

Is there another way load HTML from a remote file and inject it into
the DOM (instead of $.load)?


[jQuery] Protect page which loaded by $.ajax

2009-04-23 Thread Colonel

For example I have a page: http://mysite.com/content/index.php.
On this page I use $.ajax:
$.ajax({
  type: GET,
  data: data=123456,
  dataType: 'html',
  url: temp.php,
  error:  function(msg) {...},
  success: function(msg) {...},
  complete: function() {...}
});
where temp.php - http://mysite.com/content/temp.php. On temp.php I use
requests for DB with param from $.ajax - data=123456.

How I can protect page temp.php? For example, somebody typing
http://mysite.com/content/temp.php?data=123456 and then he can get all
results.

I found one solution - using if($_SERVER['HTTP_REFERER'] == http://
mysite.com/content/) {}

But Am not shure that it can realy protect my page? Or Am not right?

Thanks.


[jQuery] Re: Protect page which loaded by $.ajax

2009-04-23 Thread Colonel

But if there is bad user which have login? So he can access to this
page. But I need protect it from auth and unauth users. From unauth
users of course I can protect it with SESSION, but how I can protect
it from auth users?

On 24 апр, 04:46, donb falconwatc...@comcast.net wrote:
 Session variables will be shared between the ajax page and the calling
 page.  So, if you log in the user somehow and store a session variable
 that indicates they are logged in, just check that the appropriate
 variable exists.

 On Apr 23, 8:30 pm, Colonel tcolo...@gmail.com wrote:

  For example I have a page:http://mysite.com/content/index.php.
  On this page I use $.ajax:
  $.ajax({
    type: GET,
    data: data=123456,
    dataType: 'html',
    url: temp.php,
    error:  function(msg) {...},
    success: function(msg) {...},
    complete: function() {...}});

  where temp.php -http://mysite.com/content/temp.php. On temp.php I use
  requests for DB with param from $.ajax - data=123456.

  How I can protect page temp.php? For example, somebody 
  typinghttp://mysite.com/content/temp.php?data=123456andthen he can get all
  results.

  I found one solution - using if($_SERVER['HTTP_REFERER'] == http://
  mysite.com/content/) {}

  But Am not shure that it can realy protect my page? Or Am not right?

  Thanks.


[jQuery] Check $.load ajax request is complete

2009-04-22 Thread Colonel

Is the there way to check ajax request is complete for success?

On page: http://docs.jquery.com/Ajax/load#urldatacallback about
callback (Optional): The function called when the ajax request is
complete (not necessarily success).


[jQuery] Alternate $.load

2009-04-22 Thread Colonel

Is there another way load HTML from a remote file and inject it into
the DOM (instead of $.load)?


[jQuery] Re: Check $.load ajax request is complete

2009-04-22 Thread Colonel

I know it. But how I can get content from remote file by $.ajax?
For example I have some file temp.php:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
 titleTest file/title
 meta http-equiv=Content-Type content=text/html;
charset=windows-1251
/head
body
 div id=headerpSome text in div header/p/div
 ?
 $id = isset($_GET[ID]) ? $_GET[ID] : ;
 $number = isset($_GET[NUMBER]) ? $_GET[LOT_NUMBER] : ;
 echo pbid =/b . $id . /p;
 echo pnumber =  . $number . /p;
 ?
div id=header2pSome text in header2 .../p/div
/body
/html

and Am using $.ajax:

$.ajax({url: 'temp.php',
cache: false,
error:  function(msg) {alert(Error Saved:  + msg);},
success: function(msg) {alert(Data Saved:  + msg);},
complete: function() {$.unblockUI();}
   });

how I can get for example content only from div with id=header2 ?

On 23 апр, 02:26, James james.gp@gmail.com wrote:
 I suggest using the $.ajax() function instead of $.load() as it'll
 provide you more options, including success, error and complete (after
 success and error callbacks are executed)

 http://docs.jquery.com/Ajax/jQuery.ajax#options

 On Apr 22, 11:49 am, Colonel tcolo...@gmail.com wrote:

  Is the there way to check ajax request is complete for success?

  On page:http://docs.jquery.com/Ajax/load#urldatacallbackabout
  callback (Optional): The function called when the ajax request is
  complete (not necessarily success).


[jQuery] Re: Alternate $.load

2009-04-22 Thread Colonel

I know it. But how I can get content from remote file by $.ajax?
For example I have some file temp.php:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
 titleTest file/title
 meta http-equiv=Content-Type content=text/html;
charset=windows-1251
/head
body
 div id=headerpSome text in div header/p/div
 ?
 $id = isset($_GET[ID]) ? $_GET[ID] : ;
 $number = isset($_GET[NUMBER]) ? $_GET[LOT_NUMBER] : ;
 echo pbid =/b . $id . /p;
 echo pnumber =  . $number . /p;
 ?
div id=header2pSome text in header2 .../p/div
/body
/html

and Am using $.ajax:

$.ajax({url: 'temp.php',
cache: false,
error:  function(msg) {alert(Error Saved:  + msg);},
success: function(msg) {alert(Data Saved:  + msg);},
complete: function() {$.unblockUI();}
   });

how I can get for example content only from div with id=header2 ?


On 23 апр, 01:55, Shane Riley shanerileydoti...@gmail.com wrote:
 You can use a number of Ajax functions built in to JQuery depending on
 your specific needs. Check them out athttp://docs.jquery.com/Ajax. If
 all you're looking to do is insert one file into another, load is
 normally the way to go, unless you're looking to place the loaded file
 before, after, or in between elements rather than inside a placeholder
 element.

 On Apr 22, 5:50 pm, Colonel tcolo...@gmail.com wrote:

  Is there another way load HTML from a remote file and inject it into
  the DOM (instead of $.load)?


[jQuery] Get specific content (from div, p) from $.ajax

2009-04-22 Thread Colonel

How I can get content from remote file by $.ajax?

For example I have some file temp.php:
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
 titleTest file/title
 meta http-equiv=Content-Type content=text/html;
charset=windows-1251
/head
body
 ?
 $id = isset($_GET[ID]) ? $_GET[ID] : ;
 $number = isset($_GET[NUMBER]) ? $_GET[NUMBER] : ;
 echo pbid =/b . $id . /p;
 echo pnumber =  . $number . /p;
 ?
 div id=headerpSome text in div header - ?=$id?/p/div
 div id=header2pSome text in header2 - ?=$number?/p/div
/body
/html

and Am using $.ajax:

$.ajax({url: 'temp.php',
data: ID=1NUMBER=123,
cache: false,
error:  function(msg) {alert(Error Saved:  + msg);},
success: function(msg) {alert(Data Saved:  + msg);},
complete: function() {$.unblockUI();}
   });

how I can get for example content only from div with id=header2 or
both divs (not hole data - msg)?

Thanks.


[jQuery] Using $.load() and $.blockUI [blockUI.js]

2009-04-18 Thread Colonel

Hi all,

how I can add content from div to div?

For example, I have code:
..
script type=text/javascript
 !--
 $(document).ready(function() {
  $(#showDialog).click(
   function()
{
 $(#container).load('wait.php?ID=374NUMBER=1');
 $.blockUI({
  message: $(#approve),
   css:{width:275px}
 });
}
);
  $(#yes).click(function() {
   $.unblockUI({fadeOut:200});
   $.blockUI({message: h1Remote call in progress.../h1});
});
   $(#no).bind(click, $.unblockUI);
  }
);
 // --
 /script
.
body
 div id=container style=display:none;/div
 div id=approve style=display:none; cursor: default
  p id=buttons
   input type=button id=yes value=Yes
   input type=button id=no value=No
  /p
 /div
 input id=showDialog type=submit value=Show Dialog
/body

My task is:
On click button load result from file wait.php (where I make some
requests to DB), block page ($.blockUI), load result from wait.php and
merge it with #approve div. In code
 $.blockUI({
  message: $(#approve),
   css:{width:275px}
 });
I need merge #approve div and #container div. I try .append, .appendTo
and it's not help.

How I can do it?

Thanks a lot.


[jQuery] Re: Using $.load() and $.blockUI [blockUI.js]

2009-04-18 Thread Colonel

I was tying .append, .appendTo, but it's not working.

Can you help me with examples?

For example, I have 2 divs: 1 with result from wait.php and 2 with
buttons. How I can merge these 2 divs?

My full code:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
titleUntitled/title
script type=text/javascript src=http://code.jquery.com/jquery-
latest.js/script
 script type=text/javascript src=jquery.blockUI.js?v2.17/
script
script type=text/javascript
!--
 $(document).ready(
 function() {
$(#showDialog).click(
 function()
 {
 
$(#container).load('wait.php?ID=374LOT_NUMBER=1');

//$(#container).show();

$(p#buttons).before($(#container).load('wait.php?
ID=374NUMBER=1'));
 
//$(#question).html($(#container1).html());
 $.blockUI({
 message: $(#approve),

css:{width:275px}
});
}
);
$(#yes).click(function() {
 $.unblockUI({fadeOut:200});
 $.blockUI({message: h1Remote call in progress.../h1});
});
$(#no).bind(click, $.unblockUI);
}
);
 // --
 /script
/head
body
 div id=container style=display:none;/div
 div id=approve style=display:none; cursor: default
 p id=buttons
   input type=button id=yes value=Yes
   input type=button id=no value=No
/p
/div
input id=showDialog type=submit value=Show Dialog
/body
/html


On 18 апр, 16:35, victorg vr.gerrit...@gmail.com wrote:
 Where in your code are you trying to do this?

 You should use it like this: $(#content).appendTo
 (#itemwherecontentneedstobeappendedto);

 On Apr 18, 12:42 pm, Colonel tcolo...@gmail.com wrote:

  Hi all,

  how I can add content from div to div?

  For example, I have code:
  ..
  script type=text/javascript
   !--
   $(document).ready(function() {
    $(#showDialog).click(
     function()
      {
       $(#container).load('wait.php?ID=374NUMBER=1');
       $.blockUI({
        message: $(#approve),
         css:{width:275px}
       });
      }
  );
    $(#yes).click(function() {
     $.unblockUI({fadeOut:200});
     $.blockUI({message: h1Remote call in progress.../h1});
      });
     $(#no).bind(click, $.unblockUI);
    }
  );
   // --
   /script
  .
  body
   div id=container style=display:none;/div
   div id=approve style=display:none; cursor: default
    p id=buttons
     input type=button id=yes value=Yes
     input type=button id=no value=No
    /p
   /div
   input id=showDialog type=submit value=Show Dialog
  /body

  My task is:
  On click button load result from file wait.php (where I make some
  requests to DB), block page ($.blockUI), load result from wait.php and
  merge it with #approve div. In code
       $.blockUI({
        message: $(#approve),
         css:{width:275px}
       });
  I need merge #approve div and #container div. I try .append, .appendTo
  and it's not help.

  How I can do it?

  Thanks a lot.


[jQuery] Merge 2 divs [jQuery]

2009-04-18 Thread Colonel

Hi all, I have 2 divs. How I can merge this 2 divs (first div I have
after $.load like this $(#div1).load(file.php)) by jQuery?
I was trying .append, .appedndTo, but it's not working. May be Am not
properly trying.

$(#div2).append($(#div1));
$(#div2).append($(#div1).html);
$(#div2).append(#div1);

$(#div1).appendTo($(#div2));
$(#div1).appendTo($(#div2).html);
$(#div1).appendTo(#div2);

Sorry, I just study learn jQuery.

Thanks.



[jQuery] Using message in $.blockUI

2009-04-17 Thread Colonel

Hi all,

I have some problem with code:
When I try code like this:

$('#showDialog').click(function()  {
$('#question').load('wait.php?ID=1NUMBER=1');
$.blockUI({message: $('#question'), css:{width:'275px'}});
});

I have some error in IE: Unexpected call to method or treatment to the
property.

How I can get content from wait.php and return it to message?

Am trying this:

$('#showDialog').click(function()  {
$.blockUI({
 message: function() {
 $('#question').load('wait.php?ID=1NUMBER=1');
 return $('#question');
 },
 css:{width:'275px'}});
});

and this:

$('#showDialog').click(function()  {
$.blockUI({
 message: function() {
 $('#question').load('wait.php?ID=1NUMBER=1');
 return $('#question');
 },
 css:{width:'275px'}});
});

and this:

$('#showDialog').click(function()  {
$.blockUI({
 message: function() {
 $.ajax({url: 'wait.php?ID=374LOT_NUMBER=1', cache: false, success:
function(msg) {return $('#question').html(msg);}});
 return $('#question');
 },
 css:{width:'275px'}});
});

How I can do it correct? Help me please.

Thanks a lot.


[jQuery] Using message param in $.blockUI [jquery.BlockUI.js]

2009-04-17 Thread Colonel

Hi all,

I have some problem with code:
When I try code like this:

$('#showDialog').click(function()  {
$('#question').load('wait.php?ID=1NUMBER=1');
$.blockUI({message: $('#question'), css:{width:'275px'}});
});

I have some error in IE: Unexpected call to method or treatment to the
property.

How I can get content from wait.php and return it to message?

Am trying this:

$('#showDialog').click(function()  {
$.blockUI({
 message: function() {
 $('#question').load('wait.php?ID=1NUMBER=1');
 return $('#question');
 },
 css:{width:'275px'}});
});

and this:

$('#showDialog').click(function()  {
$.blockUI({
 message: function() {
 $('#question').load('wait.php?ID=1NUMBER=1');
 return $('#question');
 },
 css:{width:'275px'}});
});

and this:

$('#showDialog').click(function()  {
$.blockUI({
 message: function() {
 $.ajax({url: 'wait.php?ID=374LOT_NUMBER=1', cache: false, success:
function(msg) {return $('#question').html(msg);}});
 return $('#question');
 },
 css:{width:'275px'}});
});

How I can do it correct? Help me please.

Thanks a lot.