passing parameters in jquerymobile?

Hi,

while ($paraloop = $respuesta->fetch_array()){
      
echo '<li><a href="#carg?feeder='.$paraloop['Feed'].'">'.$paraloop['Feed'].'</a></li>';


  } //Fin del while

the li have multiple references and i need to pass the parameter

How i can make this work in jquerymobile? works without the parameter in the address
LVL 1
joyacv2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
You want to pass data to server side?
We use GET or POST
GET, the parameter is in the address that you don't want
POST, you POST a form, I don't see any to do tht with a link on page transition

A bad way would be to save the data in a cookie on click, not the click and the data-feed :
echo '<li><a class="feed" data-feed="'.$paraloop['Feed'].'" href="#carg">'.$paraloop['Feed'].'</a></li>';

Open in new window


and add this jQuery :
$(".feed").click(function() {
     $.cookie('feed', $(this).data("feed"));
});

Open in new window


read the cookie with PHP with :
$feed = $_COOKIE['feed'];
0
leakim971PluritechnicianCommented:
0
joyacv2Author Commented:
i want to use get in this case, don't require any security and can be changed in the address without problems, why cookie is a bad idea? is there other solution?
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

joyacv2Author Commented:
when i press the link, then makes a reference to another page in the same html using the #page of jquerymobile when this load, it takes the parameter and sends to another php file with ajax and jquery and returns the info
0
leakim971PluritechnicianCommented:
I don't like the idea of using cookie to pass data.
if yu want to use get you sould let the parameters in the url, just like you did it
0
joyacv2Author Commented:
but don't work with jquerymobile, is there any other solution

<a href="#page2"> works

<a href="#page2?parameter="test"> don't work

any idea to solve that?
0
leakim971PluritechnicianCommented:
be craeful with the quotes, you have doube quotes inside double quotes
try this :

<a href='page2?parameter=test' onclick="return false;">
0
joyacv2Author Commented:
this doesn't work
0
joyacv2Author Commented:
<a href="#page2"> works

<a href="#page2?parameter=test"> don't work
0
leakim971PluritechnicianCommented:
remove the sharp
0
joyacv2Author Commented:
<a href="page2?parameter=test"> don't work

<a href="#page2parameter=test"> don't work
0
leakim971PluritechnicianCommented:
so for teh cookie way
0
joyacv2Author Commented:
the cookie way don't work, any other idea, i am frustrated with jquerymobile :(
0
joyacv2Author Commented:
I found this:

HTML:

 <a href="page1.htm?structure='123'">Structure</a>
JS:

$( document ).on( "pageinit", "#page1", function( event ) {
  var parameters = $(this).data("url").split("?")[1];
  parameter = parameters.replace("structure=","");
  alert(parameter);
});

in a concurrent site

can this work in my case for a while loop?
0
leakim971PluritechnicianCommented:
use a class, don't post link from concurrent site
0
leakim971PluritechnicianCommented:
forget my previous comment
0
joyacv2Author Commented:
do you need more info?
0
leakim971PluritechnicianCommented:
did you try it ?
remove the

try this :
$( document ).on( "pageinit",function( event ) {
0
joyacv2Author Commented:
the same problem, i found that any script is running until i press refresh!
0
leakim971PluritechnicianCommented:
Try this :
$(document).on("pagebeforeshow", "#index", function () {
     $(document).on("click", ".feedLink", function() {
          var to = $(this).attr("href")
          var options = { data : { feed : $(this).data("feed") } };
          $.mobile.changePage(to, options); // http://api.jquerymobile.com/jQuery.mobile.changePage/
     });
});

Open in new window


With :
echo '<li><a href="#carg" data-feed="' . $paraloop['Feed']  . '">' . $paraloop['Feed'] . '</a></li>';

Open in new window

0
joyacv2Author Commented:
same problem, only things works after refresh the page!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
leakim971PluritechnicianCommented:
I'm going to create test page and will come back
0
joyacv2Author Commented:
perfect!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.