joyacv2
asked on
passing parameters in jquerymobile?
Hi,
while ($paraloop = $respuesta->fetch_array()) {
echo '<li><a href="#carg?feeder='.$para loop['Feed '].'">'.$p araloop['F eed'].'</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
while ($paraloop = $respuesta->fetch_array())
echo '<li><a href="#carg?feeder='.$para
} //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
A jQueyr cookie plugin : https://github.com/carhartl/jquery-cookie
ASKER
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?
ASKER
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
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
if yu want to use get you sould let the parameters in the url, just like you did it
ASKER
but don't work with jquerymobile, is there any other solution
<a href="#page2"> works
<a href="#page2?parameter="te st"> don't work
any idea to solve that?
<a href="#page2"> works
<a href="#page2?parameter="te
any idea to solve that?
be craeful with the quotes, you have doube quotes inside double quotes
try this :
<a href='page2?parameter=test' onclick="return false;">
try this :
<a href='page2?parameter=test' onclick="return false;">
ASKER
this doesn't work
ASKER
<a href="#page2"> works
<a href="#page2?parameter=tes t"> don't work
<a href="#page2?parameter=tes
remove the sharp
ASKER
<a href="page2?parameter=test "> don't work
<a href="#page2parameter=test "> don't work
<a href="#page2parameter=test
so for teh cookie way
ASKER
the cookie way don't work, any other idea, i am frustrated with jquerymobile :(
ASKER
I found this:
HTML:
<a href="page1.htm?structure= '123'">Str ucture</a>
JS:
$( document ).on( "pageinit", "#page1", function( event ) {
var parameters = $(this).data("url").split( "?")[1];
parameter = parameters.replace("struct ure=","");
alert(parameter);
});
in a concurrent site
can this work in my case for a while loop?
HTML:
<a href="page1.htm?structure=
JS:
$( document ).on( "pageinit", "#page1", function( event ) {
var parameters = $(this).data("url").split(
parameter = parameters.replace("struct
alert(parameter);
});
in a concurrent site
can this work in my case for a while loop?
use a class, don't post link from concurrent site
forget my previous comment
ASKER
do you need more info?
did you try it ?
remove the
try this :
$( document ).on( "pageinit",function( event ) {
remove the
try this :
$( document ).on( "pageinit",function( event ) {
ASKER
the same problem, i found that any script is running until i press refresh!
Try this :
With :
$(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/
});
});
With :
echo '<li><a href="#carg" data-feed="' . $paraloop['Feed'] . '">' . $paraloop['Feed'] . '</a></li>';
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm going to create test page and will come back
ASKER
perfect!
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 :
Open in new window
and add this jQuery :
Open in new window
read the cookie with PHP with :
$feed = $_COOKIE['feed'];